Investigate Disk Usage from the Command Line

8 steps · about 2 h 50 min · Intermediate

  1. Measure filesystem capacity with df (reference, Linux man-pages, 20 min)

    Identify which mounted filesystem is full and compare block and inode exhaustion.

  2. Measure directory trees with du (reference, Linux man-pages, 20 min)

    Attribute allocated space to directories and summarize candidates for deeper inspection.

  3. Find files by size, time and filesystem (reference, Linux man-pages, 30 min)

    Locate unusually large or recently changed files without crossing unrelated mounts.

  4. Inspect file size and allocated blocks (reference, Linux man-pages, 20 min)

    Compare logical size, block allocation, timestamps and inode metadata for suspicious files.

  5. 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.

  6. 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.

  7. Recognize preallocated and sparse files (reference, Linux man-pages, 20 min)

    Understand why apparent length and physically allocated blocks may differ significantly.

  8. Check reserved filesystem blocks (reference, Linux man-pages, 20 min)

    Account for ext filesystem space reserved for privileged recovery and service continuity.