Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
How can I increase the number of inodes in an ext4 filesystem?

I have a homemade NAS with Debian Wheezy 64bit. It has three disks - 2x2TB and 1.5TB, pooled together using RAID1/5 and LVM. The result is a LVM Logical Volume, about 3.16TB in size, formatted as ext4 and mounted as /home. However I just found out that roughly 50GB of this capacity is used by Inodes (exact count being 212 459 520, with 256B in size or to put it in another way - one Inode per every 16k of the partition size).

While 50GB in 3.16TB is about 1.5% of the total capacity, it's still a lot of space. Since this is a storage NAS, mostly used for multimedia, I don't ever expect the /home partition to have 212 million files in it.

So, my question is this - is it possible to lower/change the number of Inodes without actually re-creating the whole partition? While it might be possible to do it, I'd still prefer to find a way to do so instead of moving 2TB of data around and waiting for RAID to re-sync again.

share|improve this question

marked as duplicate by Gilles, Renan, rahmu, Thor, uther Jan 31 '13 at 2:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 12 down vote accepted

From the mke2fs man page:

Be warned that it is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter.

So the answer is no.

What you could do is shrink the existing ext4 volume (this requires unmounting the filesystem), use the free space to create a new ext4 volume with fewer inodes, copy the data, remove the old volume and extend the new volume to occupy all the space.

share|improve this answer
    
Thank you very much, I have some free space to shuffle data around so I will follow your advice. –  Alex Darrell Aug 9 '12 at 9:22

If you have enough space you can take tar image of the file system and back it up. Then create a new ext4 partition with a higher or lower the inode count as needed. Taking a tar image and formating your partition adds the benefit of defragmenting it as well.

I know ext4 is not supposed to need it but no matter how hard you try after so much use it will need it or at least provide a speed increase at some point. Ext4 only makes it harder to fragment your drive and would still benefit from this about every 1 - 3 years. The big problem here is that a tar image and re-format is the only way I have heard of to defragment an ext4 partition.

share|improve this answer
    
The partition is freshly created (days old) so fragmentation shouldn't be a problem at this point. Thanks! –  Alex Darrell Aug 9 '12 at 9:24
1  
If you feel like risking your data ( make a backup first! ), there is launchpad.net/e2defrag –  psusi Aug 9 '12 at 13:26
    
I knew there was something in the works and seems to be working well thanks for the tip. –  Joe Aug 10 '12 at 8:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.