Linux - Help, I'm running out of inodes!

Solution 1:

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.

Solution 2:

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

lvextend -L+1G /dev/vg/var
umount /var
resize2fs /dev/vg/var
mount /var

... my inodes limit is now 128k.

Solution 3:

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.

Solution 4:

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.

Solution 5:

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 use tune2fs to increase inodes.

Personally I would go with ext4 over any version of rieserfs, just do the following when formatting:

mkfs.ext4 -I 512 /dev/foo
tune2fs -i0 -c0 -o journal_data_writeback /dev/foo

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.