Ubuntu run out of space?

If you are getting ‘running out of space’ from your SSH console,
but running a df -h shows that there are still plenty of free space left,
then most likely inode is the one that run out.

To confirm it, just run the command df -i
from the result you should be able to a 100% in the mount point,
for my case, its at the / partition, hence even tab won’t work.

Strategy to solve it is simple, find out which directory use up the inode, and clear it up.

`for i in /*; do echo $i; find $i |wc -l; done`

Just use the command above to find the root level, for my case, its /var that using almost all the inodes,
then dig further:

`for i in /var*; do echo $i; find $i |wc -l; done`

Until it finally review that /var/lib/php/session is the cause, clearing session for the site is fine,
so we just proceed to clear the entire folder.

Turns out that there are millions of file in the directory, conventional rm command will not be able to remove the folder,
so this command did the last trick:

find /var/lib/php/session/ -type f -exec rm -v {} \;

Leave a comment