Solution For Running Out of Inodes

Posted on January 28th, 2017

The inode is a data structure in Unix-like file system and which stores information about the file except its name and the path of the file. An inode is always said to be a metadata of data. A file in Unix-like system is stored in two places on the disk – data block and inodes. The contents of file stored in data block, and the inode contains the information about the data. The inode contains the following information:

1) Mode/permission (protection)

2) Owner ID

3) Group ID

4) Size of file

5) Number of hard links to the file

6) Time last accessed

7) Time last modified

8) Time inode last modified


To list the inode of files on a directory, we can use the following command.

# cd /

# ls -lai


total 132

2 drwxr-xr-x  24 root root   4096 Feb 26 13:31 .

2 drwxr-xr-x  24 root root   4096 Feb 26 13:31 ..

2637825 drwxr-xr-x   2 root root   4096 Jan 14 19:02 bin

196609 drwxr-xr-x   3 root root   4096 Feb 24 10:41 boot

3 drwxr-xr-x  16 root root   4460 Mar  5 09:35 dev

983041 drwxr-xr-x 206 root root  12288 Mar  5 07:45 etc

2 drwxr-xr-x  14 root root   4096 Dec 29 09:24 home

One of the major issues on the server side is the disk space issues and high load average issues. Most likely you got this message “No space left on device” or “disk is full” despite having enough space free on your server. If you ever face this trouble, most likely it’s because of your server exceeds the available inodes. Let’s discuss about the solution for this problem;



1) The first step is for it to check whether your server have enough free disk space. Use the below given command for checking the available disk space on the server.

# df -h

Filesystem         1K-blocks    Used     Available   Use%     Mounted on

/dev/xvda         33030016   10407780  22622236   32%     /

tmpfs             368748     0        368748     0%      /lib/init/rw

varrun            368748     56       368692      1%     /var/run

varlock            368748     0        368748     0%      /var/lock

udev              368748     108      368640     1%      /dev

tmpfs             368748      0       368748     0%      /dev/shm


2) The second step is to check the available inodes on your server. For that use below command to check the available inodes on the server.

# df -i

Filesystem         Inodes     IUsed      IFree     IUse%   Mounted on

/dev/xvda         2080768    2080768     0      100%    /

tmpfs             92187      3          92184   1%     /lib/init/rw

varrun            92187      38          92149   1%    /var/run

varlock            92187      4          92183   1%    /var/lock

udev              92187     4404        87783   5%    /dev

tmpfs             92187       1         92186   1%    /dev/shm

If the result has 100% or near of IUse% value, then the large number of files is the reason for this issue.


3) The next step is to find those files. For that we can use a small script which will list the directories and the number of files on them.

#  for i in /*; do echo $i; find $i |wc -l; done

From the output, you can see the directory which uses a large number of files, then repeat this script for that directory like below. Repeat it until you see the suspected directory.

#  for i in /home/*; do echo $i; find $i |wc -l; done


4) When you find the suspected directory with large number of unwanted files. Just delete the unwanted files on that directory and free up some inode space by following command.

#  rm -rf /home/bad_user/directory_with_lots_of_empty_files

You have successfully solved the problem. Check the inode usage now with the df -i command again, you can see the difference like this.

# df -i

Filesystem            Inodes    IUsed    IFree  IUse%  Mounted on

/dev/xvda            2080768  284431  1796337    14%   /

tmpfs                92187       3    92184     1%    /lib/init/rw

varrun                92187      38    92149     1%   /var/run

varlock                92187       4    92183     1%   /var/lock

udev                  92187    4404    87783     5%   /dev

tmpfs                 92187       1    92186     1%   /dev/shm


If you need any further assistance please contact our support department.



10 Responses to “Solution For Running Out of Inodes”

  1. K Veerapandiyan says:

    how to find out bad_user/directory_with_lots_of_empty_files. please help me out.. my instance inode is 86%

  2. Steve says:

    K Veerapandiyan says:
    May 20, 2020 at 2:42 am
    how to find out bad_user/directory_with_lots_of_empty_files. please help me out.. my instance inode is 86%

    Not sure what you mean, but it is saying:
    bad_user = the username,
    directory_with_lots_of_empty_files = the directory that has too many empty files

    So, an example would be:
    rm -rf /home/salamanderr21/media/temp downloads/

    • Hello,

      Greetings from InterServer support. Here is an effective and accurate script to find inode under your account (make sure you have SSH access enabled from server)

      You shall run:

      echo "Detailed Inodes 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"

      Wait for the command to complete its task and you should see list of directories with accurate file count on each folders and at the end total inode used in your cPanel account.

      Still have any questions? Please feel free to reach us through Live chat or email: [email protected]

      Have a good one 🙂

  3. NIXX says:

    I had the same problem.
    It turns out the mail directory was using more than 50% of the allotted Inodes.

  4. SRG says:

    Hi Jithin,

    Thank you very much, it is working and resolved inode issues in my environment.


  5. Essu says:

    Data failed to compile:
    No matching sls found for ‘firewall’ in env ‘base’
    in addition the problem is in security onion after configuration i can not access with browsers please help me

Leave a Reply