Part 1 of 7 · 2 min read
Why this page comes last
In this module you will
- Follow a method for a full-disk report: state the numbers, then test each possible cause in turn.
- Explain why
dfandducan disagree, and name three causes. - Reproduce a file that was deleted while a program still held it open, and find it in
/proc. - Explain sparse files, and read apparent size and real use from
lsanddu. - Use
df -iand the reserved-block count to explain a disk that is full when it is not.
Pages 1 to 6 gave the model of a file system: names and inodes, blocks and extents, crash safety, copy-on-write, and the mount layer. This page closes Level 9 with the problem that almost every operator meets: the disk is full and nobody can say why. Each cause is one of the ideas of the earlier pages, seen from the outside. Level 8's method of measuring first is used again, and Level 12 returns to it for whole systems.
About this example About this example
Real: Every figure comes from a 32 MiB ext4 image (4 KiB blocks) that was mounted through a loop device on a Linux test machine (kernel 6.18, e2fsprogs 1.47.0). The C program of section 2 was compiled with gcc -Wall -Wextra. The outputs of df, du, ls, filefrag and tune2fs are as printed.
Scripted: The story of an operator who finds a full disk is made up to give the work a shape. The log rotation example of the exercises and its 2 MB/s write rate are made up to show the idea.
Not real: The image is small and has no other users. A real server has many programs that write, several mounts, snapshots and quotas. I did not trace the whole difference between the Size and Avail columns of df on the image, only the part that comes from reserved blocks.