What is an Inode Count and how to check it

Overview on the Inode Count of your hosting account

In this tutorial we will review what inode count is and two methods on how to check the inode count via your cPanel and a command line.

 

Inode is the internal data structure that Linux use to store information about the file system object. The inode count is equal to the count of all files and directories in the user account. This includes everything on your account, emails, files, folders and anything you store on the server, for example each new file or directory add a 1 to the total inode count.   

 

In order to maintain high performance and to provide our clients with enough inode count we from FastComet provide our clients with 500,000 inode count even on our shared hosting packages.

 

To manage your Inode Count, you will need to:

Step 1 Check the Inode Count

In this step we will review how to check the inode count via cPanel and command line.

 

• If you are using our shared hosting packages the inode count can be easily checked via the cPanel>Stats column which is placed at the left side of the page. At the Stats column check the File Usage row. On the left side of the slash ( / ) is indicated the inode usage for the account and on the right side of the slash character the numbers indicate the maximum allowed inode usage for the account. The first number indicates how many inodes your account is using, and the second number indicates the maximum number of inodes allowed for your account. In our example image you can see that we are using 182,290 out of 450,000 maximum allowed.

 

Inode Count viewed cPanel

 

• On our cloud SSD VPS and Dedicated services the inode count should be checked via SSH command line In order to check the inode count via the SSH perform the following steps: 

 

Login to SSH and once the SSH connection is established assure that you are in the home directory via the following command:

 

cd ~

 

If you would like to determine the overall inode count, type the next command:

 

find . | wc –l

 

Note

The execution this command could take some time if you have a large number of files.

 

If you would like to check a list of the inode count for every directory sorted with the most inode usage at the top, and the least inode usage at the bottom you should use this command:

 

find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn

 

In order to check the inode usage for a certain directory you should simply access the same. For example if you would like to check the inode count for public_html type cd public_html and then execute the commands again.

 

Step 2 Reduce the Inode Count

If you exceed the inode count or you are close to reach the maximum you should check the most common causes for the high inode usage:

 

• Cron jobs and other automated process. The cron jobs which are considered for automated process can create a large number of files. Check the cron jobs and modify or disable the unnecessary and delete the files generated by the same.

 

Cron Jobs

You can check all of your cron jobs via the cPanel account -> Cron Jobs. Also check our article How to disable the mail alert by cron job command for further guidance.

 

• As we have mentioned the email messages also are part of the inode count, check your Trash and Sent folders of all email accounts and delete the unnecessary messages. If you would like to save those messages you can download them on your local computer and delete them from the server.

• Check for old backups and unused files, once you locate such remove them.

 

Congratulations! You now know how to check and reduce the inode count on your hosting account!