Writes fail with `No space left on device`, but `df -h` shows the filesystem is only 40% used.
IntermediateTroubleshootingDisk space, inodes and filesystems
Answer
Likely causes → Inodes are exhausted (millions of tiny files), or you're looking at the wrong mount.
Diagnose →
df -i /var # IUse% at 100%?
sudo find /var -xdev -type f | cut -d/ -f2-4 | sort | uniq -c | sort -rn | head
df -h "$(dirname /path/that/fails)"
Fix → Delete the small-file pile (session files, mail queue, cache dirs) with find <dir> -type f -mtime +7 -delete. If ext4 legitimately needs more inodes, it must be reformatted with -i/-N, or move the data to XFS.
Prevent → Alert on df -i as well as df -h; set cleanup for session/cache directories.
More on Disk space, inodes and filesystems
`df -h` shows `/` at 100%, but `du -sh /` only adds up to 12 GB on a 50 GB disk.Intermediate`du` and `df` disagree by 20 GB and `lsof +L1` shows nothing. What else could hide the space?AdvancedA cron job that runs `rm /var/spool/app/*` fails with `/bin/rm: Argument list too long`.Beginner`touch /data/test` returns `touch: cannot touch '/data/test': Read-only file system`.BeginnerAfter a power failure, mounting an XFS volume fails with `mount: /data: wrong fs type, bad option, bad superblock on /dev/sdb1`.Intermediate`mount -a` says `mount: /backup: can't find UUID=3f1a...` after someone recreated the filesystem.Beginner