Linux: Check inode usage in folders

Inodes are temporarily files stored on your server which are currently in use and not closed. They could be cache, temporary files or anything related and could be created in several different ways.

Your server most likely has an inode usage quota (especially on VPS and shared hosting accounts) and if you exceed this it has a very similar effect to exceeding your actual disk space or random access memory (ram). The server locks up and services start failing one by one in a random fashion.

Below is a command to see the directories with the highest to lowest inode usage on your server, in the current directory. Doing this in your server root might take very long so best is to CD into the folder/directory where you expect the high inode usage might be and then execute this command:

find -maxdepth 1 -mindepth 1 -type d |while read dir ; do echo -n "$dir - " ; find "$dir" |wc -l; done|sed 's|^./||'|column -t|sort -rnk3|head -n10

You can also get this from the raw paste data on Pastebin:

Once you see which folders/directories have the highest inode usage, you can cd into them until you find the folder with the actual problem. It could be a cache folder or a folder storing temporary images or something related.