No Space Left on Device, Linux Partition

[Total: 5    Average: 5/5]

So you are encountered error No Space Left on Device, but when you run the command df -h you see that lot of space is available. Possibly, inodes on the server are full. As you can see my server below is showing lot of space is available.

[root@24x7serversolutions var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 5.9G 1.9G 3.7G 34% /var

But when I try to touch a test file, I’m getting the error “No space left on device”

[root@24x7serversolutions var]# touch /var/test
touch: cannot touch `/var/test’: No space left on device

In such cases, you should check disk-inodes, using the “df” with -i option to print inode details.

[root@24x7serversolutions var]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 385024 385024 0 100% /var

Well there we have it, all the available inodes for this partition have been used. That’s certainly going to cause some problems. It’s amazing that the server itself was still running. This means that there are probably a whole slew of empty files taking up inodes that don’t need to be there. To find these issue the following command:

[root@24x7serversolutions var]# for i in *; do echo $i; find $i |wc -l; done

You may have to cd into sub-directories and run the above command over again until you find the location of the directory that contains the files you’re looking for. Once you find them. You’ll need to evaluate them to make sure you can remove them. Once you remove some of these garbage files you should have plenty of inodes available and be back up and running.