This article guides you to understand what an inode count is, how you can determine it for your account, and how you can reduce it whenever is necessary.
# Inode Count
An inode is simply an internal data structure that is used by Linux to store information about a filesystem object. The inode count is equal to the total number of files and directories present in a user account or on a disk. Each file or directory will add 1 to the inode count.
Inode has limits in place for shared hosting accounts to maintain the reliability and performance of users accounts. If the maximum limit of inode count for an account is reached, then you need to decrease the count by removing some files and directories.
# Steps to determine the Inode count
Your hosting package type determines the method you should use to determine the inode count like :
1) If you have shared hosting or reseller hosting package, then you can use cPanel or the command line to determine the current inode usage for your account.
2) For all the other types of hosting packages (that include managed VPS, all unmanaged packages and managed Flex Dedicated server), you must have to use the command line to determine the current inode usage.
# Method 1: Using cPanel
Perform the following steps to determine the current inode count using cPanel :
1) Log in to cPanel
2) Go to Stats column present on the cPanel home screen, and locate the File Usage row. The first number represents the number of inodes your account is using, whereas the second number represents the maximum number of inodes that are allowed for your account. For example, the following image represents that an account is using 96,769 inodes and the maximum 300,000 inodes are allowed.
# Method 2: Using the command line
Perform the following steps to determine the current inode count for directories in your account using the command line :
1) Using SSH, log into your account.
2) Type the following command to ensure that you are in your home directory :
3) Now, type the following command to determine the total inode count for your account :
find . | wc -l
4) To determine a breakdown of inode usage for all directories located in the current directory, type the following command :
find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
# Reduce the Inode count
Incase, the inode count for your account is too high then you should try to determine the cause as soon as possible so that you can bring it back down to an acceptable level. Some of the common causes of high inode usage are :
1) Cron jobs or other automated processes: Automated processes like cron jobs are able to create a large number of files very quickly. In such a case, either modify or disable the cron job, or you can delete the unwanted files.
2) E-mail messages: Old messages in the Trash and Sent folders of user’s mailboxes often accumulate. You can also download these messages to your local computer (in-case you want to save them) and then delete them on the server.
Also Read :