All jobs / DevOps / SRE / cloud / Linux
DevOps / SRE / cloud interview question · 3–5 years
`df -h` says the root volume is 100% full. `du -sh /` adds up to less than half of that.
What is going on, and what do you do?
The strongest answer
A deleted file is still held open — usually a rotated log — so its space is not freed; `lsof +L1` finds the holder, then reopen or truncate via /proc/PID/fd. Also check `df -i` for inodes
Why it works
Exactly — unlinked-but-open files are the classic df/du gap. Find the holder, release it properly, and fix the log rotation so it does not recur.
What a good answer covers
- df sees the disk; du sees the tree.
- Look for deleted-but-open files.
- Check inodes too.
- Fix the rotation, not just the symptom.
Answers that fall short
- Close, but not the strongest: Something in a mount du cannot see; I would reboot so the kernel frees whatever it is
A reboot does release the file, but it is a blunt fix that takes down the host and teaches nothing about the rotation bug. - Weak: du is just inaccurate on large trees; I would grow the disk
du is accurate for what it can see; growing the disk buys hours and hides the leak. - Red flag: Run `rm -rf /var/log/*` to get space back quickly
Deleting live logs destroys evidence, may not free the space at all if they are open, and breaks the log shipper.
Who gets asked this
More Linux questions
- Load average is 40 on an eight-core VM, yet `top` shows CPU mostly idle and the app is crawling. What does…
- `./deploy.sh` says “Permission denied” and `ls -l` shows `-rw-r--r--`. What do you do?
- What do you check, and what was the likely mistake?
- Everyone SSHes as root with the same key. What do you change first?
- A service fails to start with “address already in use” on port 8080. How do you find out what holds it?
- A runbook installs a CLI on every server with `curl https://… | sudo bash`. What do you prefer, and why?
- A deploy script failed on step two (the build), carried on, and pushed an empty artifact to production. What…