Investigate Disk Usage from the Command Line
8 steps · about 2 h 50 min · Intermediate
- Measure filesystem capacity with df (reference, Linux man-pages, 20 min)
Identify which mounted filesystem is full and compare block and inode exhaustion.
- Measure directory trees with du (reference, Linux man-pages, 20 min)
Attribute allocated space to directories and summarize candidates for deeper inspection.
- Find files by size, time and filesystem (reference, Linux man-pages, 30 min)
Locate unusually large or recently changed files without crossing unrelated mounts.
- Inspect file size and allocated blocks (reference, Linux man-pages, 20 min)
Compare logical size, block allocation, timestamps and inode metadata for suspicious files.
- Sort a focused directory listing (reference, Linux man-pages, 15 min)
Use human-readable sizes and time or size ordering after narrowing the search scope.
- Inspect a process's open file descriptors (reference, Linux man-pages, 25 min)
Use proc file-descriptor links to identify deleted files that a running process still holds open.
- Recognize preallocated and sparse files (reference, Linux man-pages, 20 min)
Understand why apparent length and physically allocated blocks may differ significantly.
- Check reserved filesystem blocks (reference, Linux man-pages, 20 min)
Account for ext filesystem space reserved for privileged recovery and service continuity.