I have a filesystem that has lots of small files. Currently about 80% of inodes are used (I checked with df -i
), however only 60% of disk space is used. How can I 'increase' the number of inodes? If it was just disk space, I know that I could just increase the size of the disk (this disk is on LVM). If I increase the size of the disk, will that make me have more inodes?
I'm willing to grow the filesystem this disk is on, if that'd help.
To answer the original question, even though it is probably late for the questioner - yes, increasing EXT2/3 on LVM2 will also increase the inodes limit.
Just had a partition of 1G size with 65k inodes limit. After
... my inodes limit is now 128k.
man mke2fs
You will see a -N for number of inodes
So you can spec it when you format a new partition. Not so helpful right now, huh?
tune2fs, which tunes the filesystem, doesn't seem to have a way to add more inodes.
But maybe ext3 or 4 does this, and someone else knows....?
So now you have an option: backup, reformat partition, restore.
If you were knowing that small files will eat your disk space, you should have used a FS with dynamic inode allocation, like ReiserFS or any new modern FS (XFS, JFS) instead of EXT2/3/4 (which I assume you are using, you not said that).
A filesystem migration is probably a good choice in your situation.
As a stopgap, mount a new filesystem, and cp/rm/ln-s some of your fs hierarchy there. Now you have a few spare inodes! You can't mv files between the two fses, so beware breaking things that need to do that, but for many apps this can be transparent.
Then make a new fs, per Paul's advice, and migrate onto that.
Ext4 suffers the same problem, if you create a small partition and have a ton of small files you will run out of inodes, and if you have
flex_bg
in features you can't usetune2fs
to increase inodes.Personally I would go with ext4 over any version of rieserfs, just do the following when formatting:
Formatting this way will give you 33160 inodes on a 512M boot partition.
I say this as someone who used reiserfs for years, the kernel support isn't as good as ext*, and the filesystem gets fragmented over time and gets slow.
Go for resiserfs or any other fs with no inode limitation. Specially regarding to log files, probably you could pack some tons of small unused files into one bigger tar file in order to free a pretty amount of inodes =)