How to find the INODE usage on Linux

By -

“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.

admin@GeeksAlive:~$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 1004603 624 1003979 1% /dev
tmpfs 1010407 906 1009501 1% /run
/dev/sda4 3129344 346551 2782793 12% /
tmpfs 1010407 118 1010289 1% /dev/shm
tmpfs 1010407 5 1010402 1% /run/lock
tmpfs 1010407 16 1010391 1% /sys/fs/cgroup
/dev/sda1 0 0 0 - /boot/efi
/dev/sda6 56655872 101325 56554547 1% /home
tmpfs 1010407 29 1010378 1% /run/user/1000

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

How to check the Inode count of your account?

admin@GeeksAlive:~$ find . | wc -l
156

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

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

admin@GeeksAlive:~$ 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.

Detailed Inode usage: /home/admin
3 - .compiz
39 - .config
25 - Desktop
1 - Documents
1 - Downloads
1 - .gconf
2 - .gnupg
58 - .local
1 - Music
6 - .nv
1 - Pictures
1 - Public
1 - share
2 - .ssh
1 - Templates
1 - Videos
Total: 156

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. Emails
  3. 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 within the limit.

In cPanel/WHM servers, Inode usage issues can also happen due to a large number of cPanel comet files present under “~/.cpanel/comet/channels” directory. This is something that usually happens when a very high number of emails are stuck in the mail queue manager.

In such cases, you can execute the following script to remove the deadly comet files.

/usr/local/cpanel/bin/purge_dead_comet_files

That’s it !!!

So in this article, we have learned how to find the Inode usage on Linux systems. Any queries?? Please leave a comment below.

Rate this post

TheGeeksAlive is all about Linux, Server Administration, Web Hosting and other Open Source Technologies.

ăn dặm kiểu NhậtResponsive WordPress Themenhà cấp 4 nông thônthời trang trẻ emgiày cao gótshop giày nữdownload wordpress pluginsmẫu biệt thự đẹpepichouseáo sơ mi nữhouse beautiful