Dev Journal

No space left on device, but df shows free space

16 October 2026

A write fails with "No space left on device" while df -h shows plenty of free space. Before blaming the disk, check inodes. Every file uses one, and a filesystem has a fixed number of them.

df -i

If IUse% is at or near 100%, that is the cause. It usually comes from a directory that collects a huge number of tiny files, such as session data, a mail queue, or cache entries that nothing cleans up. To find it, count files per top-level directory on the same filesystem:

find /var -xdev -type f | cut -d/ -f1-3 | sort | uniq -c | sort -rn | head

The -xdev option keeps find from crossing into other mounts. Once you know the directory, delete files by age rather than all at once, and fix the thing that creates them.

There is a second cause worth checking if neither df output looks wrong. A file that was deleted while a process still holds it open keeps using its space until the process exits. List such files with lsof +L1, and restart the owning service to release the space.