Hopefully, someone can help me,

A Magento website I'm managing keeps going down, I've determined it to be the fact that it has used up all of the Inode space on the server.

The output to df -i is below..

/dev/vda1 3932160 3932160 0 100% /
none 506035 2 506033 1% /sys/fs/cgroup
udev 503322 402 502920 1% /dev
tmpfs 506035 323 505712 1% /run
none 506035 4 506031 1% /run/lock
none 506035 1 506034 1% /run/shm
none 506035 2 506033 1% /run/user

As you can see it is quite clearly the top one with the problem. As it's a Magento site, I do have a feeling it's the var/session folder. I have changed to it's directory within PUTTY (the session folder) and typed in 'ls' and the list seems to go on forever. I should delete them all, no?

So my file system is out of inodes.. and the session folder I believe is the culprit, How can i go about resolving this? I.e what code do i input to delete said session files?


I wouldn't delete all sessions, start with the older ones first. Since the quote is valid for 30 days you could try going with that. In your var/session folder.

find . -mtime +30 -exec rm {} \;

This will find all files older then 30 days and delete them. Optionally you can run this as a cronjob, do remember to replace the dot with the full path to the session files /path/to/magento/var/sessions/*

Also check the size of the report folder and the individual log files. Those tend to run up as well.

And the log_ tables in Magento can become quite large which would consume quite some disk space. You can truncate the following tables.


To turn off writing to these tables all together follow this tutorial. It's actually also beneficial for performance.

  • Thanks so much for your help, I will give this a shot first thing tomorrow. Along with the answer below from fschmengler. – A. Lal Sep 4 '15 at 20:28

First verify that it's really a problematic amount of session files:

ls -U1 | wc -l

is a fast command to give you the number of files in the current directory

Then only delete old session files, otherwise you'll log out all customers and empty the cart of all guests (see answer by Sander Mangel)

Also have a look at other directories in var. This command shows you the used inodes of all directories in var:

du --inodes --max-depth=1 ./var

You might also have a big number of files in var/report (but that also means, the shop throws lots of exceptions and you have more problems...).


first go to the var/session folder of the magento root directory

find . -name "*" -print | xargs rm -rf

This command will delete all the data in the current folder without prompting you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.