Last Updated: February 25, 2016
·
1.135K
· gump

No space left on device, but df showing space available

Ever had this problem, where computer says No space left on device, but when you run df it says space is available?

Space left, but no space left? WTF?

Run df -h and you see space is available, for example:

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.9G  4.4G  3.1G  59% /

But when you try to do anything like touch /tmp/filename it raises No space left on device error.

All inodes used up?

Run df -i and you see there are no inodes available. If you see that 100% are in use like below - at least you are on the right track:

Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/xvda1       524288 524288     0  100% /

There is certainly a problem somewhere!

Identify folders with many little files in them

Run cd / and then sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n to get a list of directories with many files in them. Navigate and re-run the command as many times as needed to find the offenders, then delete the unnecessary files. This should free up the inodes and both df -h as well as df -i should return results that are "similar" (they will rarely be identical).

Big thanks to DD for helping me solve this issue