In progress… This post will be updated if I get any more information/fixes…
I currently have a web-server (Centos6) hosted at a third-party. Today the Inodes usage was 100% for the second time in 3 months.
It looks like it’s the PHP sessions that fills up. Last time I tried to edit the session-settings in php.ini, but didn’t seem to have any affect, as it just got full again. A quick google search told me that a Cron-job is supposed to do some cleanup, so this is missing or the filesystem is corrupt.
The server is installed from a template, so I assume the template is either missing this Cron-job or it has a corrupt filesystem – as this is is the first time I have had this problem. We also running a Centos7 server at the same hosting company, and it’s iNodes looks fine.
[root@webserver ~]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/xvda1 983040 983040 0 100% / tmpfs 434887 1 434886 1% /dev/shm
To find out where the inodes are beeing used:
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
This could take some seconds/minutes…
This will produce a result like:
[...] 631 /usr/lib64/python2.6 856 /usr/share/man/man1 1766 /usr/share/man/man3 7422 /tmp 735142 /var/lib/php/session
Delete the PHP sessions with this command (basic delete can fill up the memory and crash the server):
# find /var/lib/php/session -type f -delete
It will take some time to delete the files… I got the total iNode usage down to 7% after deleting all sessions.
I also changed the session.gc_maxlifetime one more time. There is a lot of good info about session.gc_maxlifetime in this thread: http://stackoverflow.com/questions/1236374/session-timeouts-in-php-best-practices. So now I just have to wait again, to see if this helped this time.
Total amount of iNodes?
The server has only 983040 avalible iNodes. This server is installed with a template from the hosting-company.
One of my own Centos-server has 52428800 iNodes total.
This is a difference by 51445760 iNodes – so it doesn’t look like I have much to go on.
I’m stilling reading/learning about the inode-byte-ratio, best-practices and stuff. So I can’t really say what’s the best long term solution for this problem at the moment.