A write fails with No space left on device, but df -h shows the filesystem is only 40% full. What do you check next?
- The file exceeds the filesystem's maximum file size. That returns EFBIG, and modern filesystem limits are in terabytes.
- df is caching a stale value; remount to refresh it. df reads live values from statfs.
-
df -i— the filesystem may have exhausted its inodes. Every file consumes one regardless of size, so millions of tiny files fill the inode table long before they fill the blocks. ENOSPC covers both out-of-blocks and out-of-inodes; df -h only shows the first. - The disk is failing; check SMART data. A failing disk gives I/O errors, not ENOSPC.
A filesystem can run out of inodes as well as space, and both give the same error, so run df -i too.
This is a favourite because the error message points one way and the truth is elsewhere. The habit worth having: when ENOSPC and df -h disagree, run df -i before doing anything else.
Running only df -h, seeing plenty of space, and going to look for a hardware fault instead.