linux df and OSError: [Errno 28] No space left on device
By Emily Wilson •
I've got a weird inconsistency (although I'm probably just missing something quite basic). While running some script that generates small files on my I disk, I constantly get this error:
OSError: [Errno 28] No space left on deviceBut when I run df -h, I get:
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 15G 12G 2.2G 85% /
udev 502M 144K 502M 1% /dev
none 502M 0 502M 0% /dev/shm
none 502M 72K 502M 1% /var/run
none 502M 0 502M 0% /var/lock
none 502M 0 502M 0% /lib/init/rwSo am I low on disk-space or not?
Thanks for any input!
12 Answers
You're probably out of inodes. Try df -i.
This may have several causes:
- a process is currently writing a large file, so the disk usage statistics aren't updated till the file is closed. In this case you have to check the total used space by running
sudo du -k /your/path
- there are one or more deleted files which are still in use by some process, so the df utility doesn't take them into account when calculating the total disk usage; you can find these files by running
sudo lsof / | grep deleted
- the filesystem runned out of inodes, which you can check by running
sudo df -i /your/path