Deleted open file holding disk space — phantom disk usage
df shows full disk but du shows less total usage
Focused incident mode — strips away everything but this runbook.
Symptoms
- df shows full disk but du shows less total usage
- lsof shows files with (deleted) suffix
- Disk space does not reclaim after removing a large log file
Docker and systemd-journald are common culprits — both hold log file handles for the lifetime of the container/journald process. Use logrotate with copytruncate or restart containers after rotation.
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Deleted files still open
lsof +L1Space delta between df and du
df -h / && du -sh / 2>/dev/null
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- lsof shows a process holding a (deleted) file with GB-sized link count
- The file was removed from /var/log but the process never restarted
Confirm before fixing
lsof +L1 2>/dev/null | grep deleted | sort -k7 -rn | head -5Find the largest deleted-but-open files
Fix
kill -HUP <PID>Send HUP to the process so it closes the old file handle and reopens (if the app supports it)
Expected: The process reopens the log file; the deleted file space is freed
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
df -h / && du -sh / 2>/dev/nullConfirm the space discrepancy
lsof +L1 2>/dev/null | sort -k7 -rn | head -10Find deleted files still held open
kill -HUP <PID>Ask the process to reopen its log files
systemctl restart <service>Restart if HUP does not release the handle
Prevention
- Use logrotate with copytruncate for applications that cannot reopen file handles.
- Alert on df vs du discrepancy via a cron job.
- Restart services after log rotation if copytruncate is not an option.
- Monitor lsof +L1 periodically in automated health checks.
Related runbooks
Same stack, same failure family — worth a skim.
No space left on device errors in application logs
Upgraded binary but the running process still shows old version
EMFILE: Too many open files error in application logs
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.