Disk full and open deleted files
Quick answer
No space left on device may mean exhausted data blocks or inodes. A deleted file held open can also explain a difference between filesystem usage and visible directory usage.
Removing a name does not immediately reclaim a file's storage when a process still holds it open. Compare filesystem usage, visible files and authorized process evidence; distinguish block exhaustion from inode exhaustion. Avoid restarting services without understanding their impact.
Prepare the practice environment
Run python3 lab-fixtures/troubleshooting/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Run each snippet in a separate Bash process, not your interactive shell. Only private files are used; optional examples require an authorized snapshot VM. Do not change live services, mounts, policies or resource limits. All supplied records are fictional; no host incident records are collected. Review the lab guide.
Prerequisites
Review: Command and permission errors.
How it works
Check df -h PATH and df -i PATH on the affected mount, then du -x -sh PATH for the authorized directory scope. df reports filesystem accounting while du walks reachable names; permissions, snapshots, metadata, reserved blocks, other directories and open unlinked files can explain differences. Quotas may produce a distinct quota error. A read-only mount produces a different error; inspect findmnt options rather than assuming capacity. An unlinked inode remains accessible through an open descriptor until its last reference disappears. lsof +L1 selects open files with link count below one, subject to permissions. Scope the investigation to the affected service and filesystem; do not kill an arbitrary process or truncate descriptors. Arrange an approved log reopen or graceful restart when appropriate; verify capacity and application health. Revert rotation configuration if needed and prevent recurrence with retention and capacity alerts. The fixture demonstrates lifetime, not actual reclaimed block counts.
Try the examples
awk -F, 'NR>1 {print $1, "blocks=" $2, "inodes=" $3}' disk.csvThe second case needs investigation of file counts rather than just large files.
Expected stdout:
blocks-full blocks=100% inodes=40%inodes-full blocks=65% inodes=100%The helper creates and unlinks only its own temporary file and reads through the open descriptor before closing it.
Expected stdout:
path absent; links=0; bytes still readablesample=$(mktemp ./bm-open.XXXXXX)trap 'rm -f -- "$sample"' EXITprintf "private sample\n" > "$sample"exec 3< "$sample"rm -- "$sample"lsof -a -p "$$" +L1exec 3<&-Optional authorized disposable VM with lsof installed. Run in a separate Bash process in the private workspace. The shell opens its own temporary file, removes its name, and lsof inspects only that shell PID for zero-link files. Output varies. The descriptor closes on shell exit.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Never fill a real disk to reproduce ENOSPC or delete production files based only on df/du differences. Confirm the mount and cause.
Practice
Compare disk.csv cases and demonstrate the open descriptor surviving unlink. Explain why restarting a service is only one possible approved remedy.
Related references
Study: df, du, lsof. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Disk full and open deleted files — Knowledge Check
Apply troubleshooting concepts to synthetic fixtures and VM-only scenarios.
Which command reports inode usage?
An unlinked file is still readable through its descriptor. Why?
What does lsof +L1 select?
What should precede cleanup?