Linux – ext4 file-system max inode limit – can anyone please explain

ext4filesystemsinodelinux

Recently we had a problem where one of the ext4 file-systems seemed unable to handle very large number of files, more than 6mln in this case, in spite of having enough space. Is it 6mln the max number, an ext4 file-system can have when formatted with all the default settings? I tried to Google it but didn't get any definitive answer. Anyone one out here can shade some light on this please? Cheers!!

Best Answer

There is no default as such for ext4, it depends on the size of the device and the options chosen at creation. You can check the existing limits using

tune2fs -l /path/to/device

For example,

root@xwing:~# tune2fs -l /dev/sda1
tune2fs 1.42 (29-Nov-2011)
Filesystem volume name:   <none>
Last mounted on:          /

[lots of stuff snipped]

Inode count:              1277952
Free inodes:              1069532
Inodes per group:         8192
Inode blocks per group:   512

[lots of stuff snipped]

As per man mkfs.ext4

-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.

Related Topic