Drawbacks of increasing number of inodes in EXT4
Solution 1
That is a really bad idea. Every inode consumes 256 bytes (may be configured as 128). Thus just the inodes would consume 1TiB of space.
Other file systems like btrfs can create inodes dynamically. Use one of them instead.
Solution 2
I really can't stress this enough, don't create a boatload of inodes!
First your fsck
runtime can be lengthened exponentially, although some of those concerns were addressed in ext4. More importantly, inodes aren't the only limiting file number factor, it's likely impossible to use all those inodes. This isn't just practically speaking, it may actually be technically impossible.
An excerpt from the mkfs man page,
-i bytes-per-inode Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode ratio, the fewer inodes will be created. This value generally shouldn't be smaller than the blocksize of the filesystem, since in that case more inodes would be made than can ever be used. 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.
When creating the OPs new file system, realistically speaking, the OP should start to figure numbers to the maximum of bytes-per-inode = blocksize.... for everyone who reads this later, the OP has a very unusual case where he has a HUGE number files.
Related videos on Youtube
StrongBad
Updated on September 18, 2022Comments
-
StrongBad over 1 year
I am currently using
backintime
to take "snapshots" of my file system. It is similar torsnapshot
in that it, makes hard links to unchanged files. I have recently run out of inodes on myEXT4
filesystem.df -hi
reveals I have used 9.4 million inodes. A rough count of the number of current directories times the number of snapshots plus the number of current files suggests that I may in fact be using 9.4 million inodes.From what I understand the
EXT4
filesystem can support around 2^32 inodes. I am considering reformatting the partition to use all 4 billion or so inodes, but I am concerned that this is a bad idea. What are the drawbacks of having so many inodes in anEXT4
filesystem? Is there a better choice of filesystem for an application like this?-
Admin over 9 yearsNote that hard links do not use up inodes, so this is probably not backintime's fault.
-
-
StrongBad almost 11 yearsI am a little reluctant to use btrfs for my backups since it is still technically unstable. Is btrfs substantially better than reiserfs or xfs for this type of usage?
-
Hauke Laging almost 11 yearsbtrfs supports snapshots on file system level. Except for that I cannot compare it to reiserfs and xfs (am not even sure about xfs and snapshots). I am not using btrfs yet but my impression is that it is not considered unstable any more.
-
UpTheCreek about 9 yearsBut if you have a small blocksize then setting bytes-per-inode to blocksize will create a lot of inodes right? Regarding the warning in your fist sentence - what are the risks? Just fsck performance?
-
J. M. Becker about 9 years+1'd you, yes it would create lots of inodes, which IMO is stupid, but it was directed at the OP... so I wanted to provide a theoretical maximum that at least could potentially be used... since he was so off the deepend, he would have more than he could even use in theory. It was my ... dont ever go smaller than blocksize=Bytes per inode, no matter what.
-
J. M. Becker about 9 yearsO and yea, for most filesystems, like DB's and whatnot, I have large files never more than say a few thousand. So I like using
-Tlargefile4
, or evenTlargefile
for good amount more inodes. Too many inodes has a deep cost for sure, they take up space themselves, and believe me that fsck performance is dead serious. We're talking practically exponential slowdowns, like 30 seconds vs 2 days... and this is I/O bound. Not to mention slow downs of file listing, indexing... etc. no matter how good ext4 was, more inodes is more to index, even though it does it much better than ext2/3. -
J. M. Becker about 9 yearsSo don't be too scared, I just wanted to counter the OP's idea that this was somehow cost free.. EVERYTHING has it's cost, so always weigh the pros and cons. For most the default amount is a totally acceptable amount, especially for an OS drive...and the performance impact is generally minimal either way... but that assumes you're not at insane loads of inodes type numbers.
-
jaymartines about 6 years@HaukeLaging How do you know the exact size of each inode? Thanks
-
Hauke Laging about 6 years@Bionix1441 All inodes have the same size:
dumpe2fs -h /dev/whatever | grep 'Inode size'