What it is
df reports filesystem mount capacity—both disk blocks (df -h) and metadata index nodes called inodes (df -i). du walks visible directories to sum file sizes. They disagree when a file is deleted (unlinked) while a running process still keeps its file descriptor open, or when millions of tiny files exhaust inodes before gigabytes run out.
Why you need it
Simply running rm on a huge active log file does not reclaim disk blocks until the owning process closes the file. Conversely, deleting large backups will not fix an inode exhaustion outage.
How it works
- Run df -h and df -i separately to identify whether bytes or inodes are at 100% and which mount is affected.
- Compare df mount totals against du -sh on directories inside that mount.
- When df shows full but du is small, inspect open unlinked descriptors with lsof +L1.
- Reclaim space safely by truncating in place (truncate -s 0) or reloading/restarting the owning daemon—never delete unknown files blindly.
Finding deleted files still held open
df -h /var/log # 100% used
du -sh /var/log # only 120M visible!
lsof +L1 # shows api-worker holding /var/log/api-debug.log (deleted)
systemctl reload api-worker
df -h /var/log # space drops immediatelyIn Unix, unlinking removes the directory name while keeping the inode and data blocks alive until the last open file descriptor closes.
Practice ls -la, chmod, grep | wc, df -h, df -i, du, lsof, and ss -tulnp against five live troubleshooting missions.
Good practices and why
- Always check BOTH df -h (bytes) and df -i (inodes) when writes fail with ENOSPC.
- Use truncate -s 0 or logrotate copytruncate/reload when clearing active logs safely.
Common mistakes
- Running du -sh / across huge network mounts during an outage.
- Deleting an open log file and assuming the disk space was freed immediately.
Try it yourself
Complete Missions 3 and 4 in the Linux CLI Lab to resolve both an open-deleted-file block leak and an inode exhaustion incident.
What a successful result looks like
Both /var/log block usage and /tmp inode usage drop cleanly back to healthy levels.
0 / 6000 characters · Saved on this device. Do not include passwords or private data.
Check your understanding
Answer the understanding check correctly to record exercise completion.
Related interview practice
These scenarios add constraints and follow-up questions to the concepts you just learned.
Further reading
Selected primary references · reviewed 2026-10-09. Examples are educational; use your framework’s documented integration guidance when building a deployed system.