Administration

Check inode usage

How to check inode usage

]# df -i
Filesystem       Inodes    IUsed   IFree IUse% Mounted on
/dev/vda3      50044928 50044928       0  100% /
tmpfs           1950595        1 1950594    1% /dev/shm
/dev/vda1        128016       39  127977    1% /boot
/usr/tmpDSK      262144       20  262124    1% /tmp

for d in *; do echo -n "$d: "; find $d -type f | wc -l; done /home

By the way, if you’re looking for the directories that contain lots of files, this script may help:


#!/bin/bash
# count_em - count files in all subdirectories under current directory.
echo 'echo $(ls -a "$1" | wc -l) $1' >/tmp/count_em_$$
chmod 700 /tmp/count_em_$$
find . -mount -type d -print0 | xargs -0 -n1 /tmp/count_em_$$ | sort -n
rm -f /tmp/count_em_$$

Also…

# find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

Try to find if this is an inodes problem with:


# df -ih

Try to find root folders with large inodes count:


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

Try to find specific folders:


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