How to find the INODE usage on Linux Server

What is Inode?

How to find the INODE usage on Linux”. You know, in Unix/Linux everything is considered as a file. An Inode is a data structure that stores various information about a file. This includes

  • File type (executable, block special etc)
  • Ownership
  • Group Owner
  • Permission
  • File Size
  • File access, change and modification timestamp
  • File deletion timestamp
  • Number of links (soft/hard)
  • Access Control List (ACLs)

Number of Inodes indicates the number of files and folders in your account. Every Shared Hosting provider will have some INODE limits set on their server’s and hence it’s important to check the inode usage on your account regularly. This is because you won’t be able to add new files once you have reached the Inode limit allocated to your account.

How to find the INODE usage of your server?

You can use the command “df -i” to check the Inode utilization of your server.

# $ df -i

Here the output,

Here, the maximum number of inodes that can be created on /dev/vda1 is 2621440

How to check the Inode count of your account?

This will give the Inode usage of the present working directory without a breakdown of inode usage of its sub-directories.

# find . | wc -l

Here, Inode count of your account.

So, If you want to check the inode usage for the sub-directories as well, please execute the following command.

# clear;echo "Detailed Inode usage: $(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"

The output of the above command will be as follows.

How to reduce the Inode usage of your account.

The common scenarios where you will reach the Inode limit allocated for your accounts are

  1. Cache files
  2. Trash files
  3. Emails
  4. Bulk file uploading (Images)

So, please go through the Inode count of the directories under your account and remove unnecessary files/folders to bring the Inode usage.

So this is how to find the Inode usage on Linux systems.

 

Related posts

Leave a Comment