:::: MENU ::::

Find and identify where inodes are used

  • Aug 22 / 2016
  • 0

Find and identify where inodes are used

Your monitoring system is claiming that your server is running out of free inodes but your disks are not full at all? Maybe you just need to check your filesystem usage and how many files are being used at the same time… Here are some tips to check and identify the inodes being used.

First of all, you can check percentage of inodes used with this simple command:

df -ih

You will see inode usage for your partitions and mouting points:

#dh -ih
Filesystem                                    Inodes IUsed IFree IUse% Mounted on
rootfs                                          120K  7.1K  112K    6% /
udev                                            495K   356  495K    1% /dev
tmpfs                                           497K   299  496K    1% /run
/dev/mapper/vg-root                             120K  7.1K  112K    6% /
tmpfs                                           497K     6  497K    1% /run/lock
tmpfs                                           497K     2  497K    1% /run/shm
/dev/sda1                                       122K   241  122K    1% /boot
/dev/mapper/vg-usr                              179K   51K  129K   29% /usr
/dev/mapper/vg-var                              242K  199K   43K   83% /var

Here, we can easily see that /var is using 83% of inodes, which is quite high.

Let’s now identify how those inodes are used with a compound command using find:

find /var -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n

You will get a sorted result like this (I truncated to display only the last lines which are the most important):

#find /var -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
     52 /var/lib/ucf/cache
    106 /var/spool/exim4/input
    153 /var/log
    184 /var/log/apache2
    301 /var/lib/mibs/ietf
    319 /var/cache/apt/archives
   2289 /var/lib/dpkg/info
  10893 /var/spool/postfix/maildrop

We can clearly see that inodes are mostly used by /var/spool/postfix/maildrop. You just have to go in that folder and check if files are useful and/or if you can do some cleaning there.
Then, once files are removed and directory clean, your inodes will be freed and everything will be back to normal!

Comments are closed.

Question ? Contact