This article defines an inode count, discusses how to calculate it for your account, and how to minimize it if necessary.

What is the inode count?

An inode is a data structure used by Linux to hold information on a filesystem object. The total number of files and directories in a user account or on a disk is equal to the inode count. Each file or directory adds one to the total number of inodes.

Inode restrictions for shared hosting accounts are in place to ensure the reliability and speed of Hostginger Hosting servers for all customers. If your account's inode count approaches this limit, you must reduce it by eliminating some files or folders.

Determining the inode count

The method you should use to determine the inode count depends on the type of hosting package that you have:

  • If you have a shared hosting or reseller hosting package, you can use cPanel or the command line to determine the current inode usage for your account.
  • For all other types of hosting packages (including managed VPS, managed Dedicated server, and all unmanaged packages), you must use the command line to determine current inode usage.
Method 1: Use cPanel

To determine the current inode count using cPanel, follow these steps:

  1. Log in to cPanel.
  2. In the STATISTICS sidebar of the cPanel home screen, locate the File Usage row. 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. For example, the following image shows an account that is using 138,419 inodes out of a maximum of 600,000 allowed:

    cPanel - Statistics - File Usage

Method 2: Use the command line

To determine the current inode count for directories in your account using the command line, follow these steps:

  1. Log in to your account using SSH.
  2. To make sure you are in your home directory, type the following command:
    cd ~
  3. To determine the total inode count for your account, type the following command:

    find . | wc -l
  4. To view a breakdown of inode usage for all directories located in the current directory, type the following command:

    echo "Inode usage for $(pwd)" ; for d in `find -maxdepth 1 -type d | cut -d\/ -f2 | grep -xv . | sort`; do c=$(find $d | wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"
    

Reducing the inode count

If your account's inode count is too high, you should try to find the source as quickly as possible so that you can reduce it to an appropriate level. The following are some of the most typical causes of high inode usage:

  • Cron jobs or other automated processes: Automated processes, such as cron jobs, can create a large number of files very quickly. Either modify or disable the cronjob, or delete the unwanted files.
  • E-mail messages: Old messages in the Trash and Sent folders of users' mailboxes often accumulate. You can download these messages to your local computer (if you want to save them), and then delete them on the server.
Was this answer helpful? 0 Users Found This Useful (0 Votes) linux, inode count