About inodes

In Ubuntu, each file and directory is a so-called inode. You can use df -i to check the number of inodes in use and available for all mounted filesystems.


If you create a new EXT4-partition, it uses the default number of inodes, which under normal conditions should be sufficient. However, if you run a system that produces millions of small files, how do you need to create a new EXT4 partition with an extra large number of inodes? What is the maximum?


  • You can NOT change the number of available inodes AFTER the EXT4-partition has been created
  • 1
  • @Rinzwind That is not the same question as it only asks how to find the large number of small files... it does not explain how to format a new EXT4 partition with extra large number of inodes. I will reopen my question.
    – bzero
    Mar 24 '15 at 9:31
  • How can I disable that top banner saying that this question may already have been answered? This is a different question.
    – bzero
    Mar 25 '15 at 14:46

Using mkfs -t ext4 -N iNumberOfINodes /dev/XdY where iNumberOfINodes is a 32-bit number so the maximum possible number of inodes on any ext2/3/4 file system is 2^32-1, or 4,294,967,295 (~4 billion).

  • 6
    Are there any known performance drawbacks when configuring 4,000,000,000 iNodes?
    – bzero
    Mar 30 '15 at 7:20
  • 2
    actually it's not: mkfs.ext4: too many inodes (4294967296), specify < 2^32 inodes
    – dalore
    Jun 14 '17 at 17:27
  • 1
    @dalore off-by-one error: 2^32-1... Thanks for the feed-back, answer adapted... :-)
    – Fabby
    Jun 14 '17 at 20:22
  • Note I also tried that, but got another error which wasn't very informative as to what number is accepted.
    – dalore
    Jun 20 '17 at 13:54
  • have you tried 2^31???
    – Fabby
    Jun 23 '17 at 9:22

See the man page for mkfs.ext4.

man mkfs.ext4

Option -N allows you to set the number of inodes created in the filesystem, and option -I allows you to increase their size (so they can handle more extended attributes of files). Adjust to fit your situation when you create the filesystem.

  • Thanks, so -N is used at creation time whereas -l can be used to adjust the number of inodes AFTER the partition has been created? I will take a closer look at the man pages now...
    – bzero
    Mar 25 '15 at 19:40
  • 1
    The -I changes the size of each inode in bytes at creation time. It will not allow you to increase the available number of them on existing filesystems.
    – TwoD
    Feb 18 '17 at 22:24
  • "allows you to increase their size (so they can handle more files)" Increasing the inode size doesn't mean you can handle more files, the larger the bytes-per-inode ratio, the fewer inodes will be created, meaning fewer files can be handled.
    – ZN13
    Jun 4 '19 at 13:50

It's always a trade off between inodes and block size. 32-bit is the max, but the actual max depends on your disk/filesystem size divided by block size. Each file is at minimum one block. You can also specify the group size which determines how many blocks per inode. (i.e. bytes/inode)

All that will determine the number of inodes you can allocation for a particular disk size and block size.

It's also a trade off between performance versus file capacity. Smaller block size mean large files will be fragmented and require more I/O operations to load the file.

If you're gonna customize you need to read up or else you end up with a filesystem totally unsuitable for what you thought you wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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