df — report filesystem disk space usage

The disk-full panic starts here — and usually ends here too.

The disk is full, the build just died, and you have no idea which filesystem is the culprit. df answers that in one keystroke — and it has been doing it since 1971.

What it does

df (disk free) reports how much space is used and available on every mounted filesystem. Run it bare and you get a table of all mounts; point it at a path and it reports only the filesystem that path lives on. The default output is in 1K blocks, which is why the first thing everyone does is add -h for human-readable sizes. It is the sysadmin's first move when anything says 'no space left on device'.

Why it matters

df answers the two questions that matter when storage is tight: which filesystem is full, and how much headroom is left. It also shows inode usage with -i — a filesystem can be out of inodes while still showing free space, which produces the most confusing 'no space' error in Linux. Knowing df -h and df -i turns a disk panic into a two-second diagnosis.

Examples

df -h /
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv  455G  239G  197G  55% /

-h gives human-readable sizes. Point df at a path and it reports only the filesystem containing that path — the fastest way to check the disk your project actually lives on.

df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              1.6G  4.6M  1.6G   1% /run
efivarfs                           192K   68K  120K  36% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv  455G  239G  197G  55% /
tmpfs                              7.7G  324K  7.7G   1% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1p2                     2.0G  218M  1.6G  12% /boot
/dev/nvme0n1p1                     1.1G  6.2M  1.1G   1% /boot/efi
tmpfs                              1.6G   24K  1.6G   1% /run/user/1000

Bare df -h lists every mount. The tmpfs and efivarfs entries are virtual filesystems in RAM — ignore them when hunting for real disk usage.

df -i /
Filesystem                          Inodes   IUsed    IFree IUse% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv 30326784 4926159 25400625   17% /

-i reports inode usage. A filesystem can be 100% full of inodes while showing plenty of free space — this is how you catch that trap.

df -T /
Filesystem                        Type 1K-blocks      Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 476973152 250092432 206387828  55% /

-T adds the filesystem type (ext4 here). Useful when you need to know whether you are on ext4, xfs, btrfs, or a network mount.

df -h -x tmpfs -x devtmpfs -x overlay
Filesystem                         Size  Used Avail Use% Mounted on
efivarfs                           192K   68K  120K  36% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv  455G  239G  197G  55% /
/dev/nvme0n1p2                     2.0G  218M  1.6G  12% /boot
/dev/nvme0n1p1                     1.1G  6.2M  1.1G   1% /boot/efi

-x excludes filesystem types. On a container or busy box this strips the RAM-backed noise and shows only the real disks.

Flags

FlagMeaning
-hhuman-readable sizes (K, M, G) instead of 1K blocks
-ishow inode usage instead of block usage
-Tprint the filesystem type (ext4, xfs, tmpfs, ...)
-x TYPEexclude filesystems of the given type
-t TYPEinclude only filesystems of the given type
--totaladd a grand total row at the bottom
-ainclude filesystems with 0 blocks (pseudo-filesystems)

Origin

df has been part of Unix since the very first edition in 1971, alongside its sibling du. The name is a contraction of 'disk free'. It was one of the original commands Ken Thompson and Dennis Ritchie shipped, and its job — report free space on mounted filesystems — has not changed in over fifty years.

The inode trap

df -i exists because a filesystem tracks two separate resources: data blocks and inodes (the metadata entries that hold each file's name, permissions, and block pointers). A filesystem can run out of inodes while blocks remain free — typically from millions of tiny files. When that happens, writes fail with 'No space left on device' even though df -h shows free space. df -i is the only command that reveals it.

Fun facts

Pros

Cons

Takeaways