kmail.at
contact

elsewhere

EnglishEN
← learning

sysadmin · difficulty ◆

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.

AI-generated draft · reviewed and editedThis text was generated with AI as a first draft, then reviewed and edited by the author, who holds editorial responsibility for it.

2026-09-04 · 5 min read

$ df

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.

Why df and du disagree

Run `du -sh /var` and `df -h /var` and you get two different numbers for the same directory. They are answering different questions: du walks the tree and adds up the space the files it finds occupy, while df asks the filesystem how many blocks are allocated. Two things live in that gap. First, a deleted file that a process still holds open keeps its blocks allocated — it vanishes from du at once, because there is no directory entry left to walk, but it stays in df's Used column until the last file descriptor closes. Second, no filesystem hands all its blocks to ordinary users: ext4 reserves 5% of its blocks for root by default (the -m option of mke2fs), and those blocks are counted in Size but never in Avail. That is why Size minus Used is routinely larger than Avail, and why df can report free space that a non-root process still cannot write into.

Example

$ 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 rows are RAM-backed and efivarfs is the firmware's variable store — neither is real disk, so ignore them when hunting for space.

$ 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, and it can be repeated. Stripping tmpfs removes the RAM-backed noise; on a container the same trick with -x overlay is what leaves only the real mounts. efivarfs survives both filters because it is firmware storage, not RAM.

Common flags

-h
human-readable sizes (K, M, G) instead of 1K blocks
-i
show inode usage instead of block usage
-T
print the filesystem type (ext4, xfs, tmpfs, ...)
-x TYPE
exclude filesystems of the given type
-t TYPE
include only filesystems of the given type
--total
add a grand total row at the bottom
-a
include pseudo, duplicate and inaccessible filesystems — the ones with no space to report that df hides by default

History

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

pros

  • + Universal — present on every Unix-like system since 1971
  • + One command answers both space and inode questions (-h and -i)
  • + Scopes cleanly to a path: `df -h /var` reports only the disk that matters

cons

  • − Reports filesystems, not files — it cannot tell you what is eating the space (that is du's job)
  • − Default 1K-block output is unreadable without -h
  • − Virtual filesystems (tmpfs, overlay) clutter the output on containers

Takeaways

  1. 1Check a disk with `df -h /` — human-readable, scoped to the filesystem you care about
  2. 2When writes fail but df -h shows free space, run `df -i` to check for inode exhaustion
  3. 3Use -T to see the filesystem type, and -x tmpfs to strip virtual mounts from the output
  4. 4df tells you which filesystem is full; pair it with du to find what is filling it
  5. 5Add --total to get a grand total across all filesystems

Related commands