Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are all my inodes being used?

How do I find out which directories are responsible for chewing up all my inodes?

Ultimately the root directory will be responsible for the largest number of inodes, so I'm not sure exactly what sort of answer I want..

Basically, I'm running out of available inodes and need to find a unneeded directory to cull.

Thanks, and sorry for the vague question.

like image 535
Joel Avatar asked Dec 07 '08 14:12

Joel


People also ask

What is using all the inodes?

One of the possible ways in which a filesystem can run out of space is when all the inodes are used up. This can happen even when there is enough free space on disk; consumption of all inodes in the filesystem can block the creation of new files. Besides, it can result in a sudden stop of the system.

What causes high inode usage?

The number of inodes corresponds the number of files and folders you have. Therefore, the more files and folders you have on your server, the higher your inode usage will be. Keep in mind that inode usage differs from disk space usage (KB, MB, GB).

How do I check my inode usage?

You can easily check inode usage using df -i command, as shown below. It will list inode usage of all disk partitions on your Linux system. In the above output, the column IUse% indicates the inode usage in Linux. If you use Ext2/Ext3/Ext4 filesystem, you can also use tune2fs utility tool.


2 Answers

If you don't want to make a new file (or can't because you ran out of inodes) you can run this query:

for i in `find . -type d `; do echo `ls -a $i | wc -l` $i; done | sort -n 

as insider mentioned in another answer, using a solution with find will be much quicker since recursive ls is quite slow, check below for that solution! (credit where credit due!)

like image 181
Hannes Avatar answered Sep 28 '22 18:09

Hannes


Provided methods with recursive ls are very slow. Just for quickly finding parent directory consuming most of inodes i used:

cd /partition_that_is_out_of_inodes for i in *; do echo -e "$(find $i | wc -l)\t$i"; done | sort -n 
like image 36
insider Avatar answered Sep 28 '22 19:09

insider