I’m guessing that every Linux admin saw this alarming message: “No space left on device”. First thing you are doing is check disk usage of course:
# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg-lv_root 18G 13G 3.4G 80% /
What is going on? There is a lot of free space! Then you are checking free inodes:
# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/vg-lv_root 1135680 1135680 0 100% /
All inodes on ‘/dev/mapper/vg-lv’ are used! How to find where inodes are being used? To complete this task we need to use find command.
# find / -printf "%h\n" | sort | uniq -c | sort -nr | head
This command invoked as a root user displays top ten directories with the largest number of files and directories inside (and the largest number of used inodes).