Linux for operators · core
Full disks, open files and the OOM killer
Linux resource problems have clear checks: deleted files still held open keep disk space, file descriptors have limits, and the kernel OOM killer ends a big process silently.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- df asks the filesystem how many blocks are used. du walks directory entries. A file deleted while a process still has it open has no name, so du cannot see it, but its blocks stay used.
- Proof: lsof +L1 shows deleted files still held open. Free the space by truncating through /proc/<pid>/fd/<n> or by making the program reopen its log. A restart also frees it but costs downtime.
- Everything open is a file descriptor: files, sockets (one per TCP connection) and pipes. Limits are per process (soft and hard, ulimit -n, /proc/<pid>/limits) and system-wide.
- limits.conf applies to PAM login sessions, not to systemd services. For a service set LimitNOFILE= in the unit or a drop-in, then daemon-reload and restart.
- Descriptors that climb even at low traffic mean a leak. Many sockets in CLOSE_WAIT mean the other side closed but our code did not.
- A process that dies with no log line was probably killed by SIGKILL from outside: the kernel OOM killer, a cgroup limit, or a person or script. Confirm with dmesg -T and journalctl -k.
- free shows low free memory because Linux uses spare RAM for page cache. Read the available column. Swap use and major page faults matter more.
- The OOM killer chooses mostly by memory use, adjusted by oom_score_adj (-1000 to 1000), so the biggest process, often the database, loses. Fix by sizing memory, limiting other jobs and protecting the key service.
The red pen
Common traps: mistake → fix
Mistake: df and du must agree
Fix: an open deleted file makes them differ.
Mistake: Edit limits.conf to raise limits for a systemd service
Fix: set LimitNOFILE in the unit.
Mistake: Low free memory means a problem
Fix: check available.
Easy to hard
Questions interviewers ask, easy to hard
- df says the disk is full but du finds half. Why?
- The app throws Too many open files at peak. Where do you start?
- MySQL dies at 2 am with nothing in its log. What do you check?
- How do you read the output of free?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.