How to Increase Disk Inode Number in Linux

When a new file system is created on a partition on a disk in Linux, and the kernel keeps aside space for inodes during the initial structuring of the file system. The number of inodes within a file system directly affects the number of files (i.e the maximum number of inodes, and hence the maximum number of files, is set when the file system is created).

Recommended Read: How to Get Total Inodes of Root Partition

If all inodes in a file system are exhausted, the kernel can not create new files even when there is available space on the disk. In this short article, we will show you how to increase the number of inodes in a file system in Linux.

When creating a new file system on a partition, you can use the -i option to set the bytes-per-inode (bytes/inode ratio), the larger the bytes-per-inode ratio, the fewer inodes will be created.

The following example shows how to create an EXT4 file system type with a small bytes-per-inode ratio on a 4GB partition.

$ sudo mkfs.ext4 -i 16400 /dev/sdc1
Create EXT Filesystem with Smaller Inode Ratio
Create EXT Filesystem with Smaller Inode Ratio

Note: Once the file system is created, you can not change the bytes-per-inode ratio (unless you re-format it), and resizing a filesystem changes the number of inodes to maintain this ratio.

Here is another example with a larger bytes-per-inode ratio.

$ sudo mkfs.ext4 -i  196800 /dev/sdc1
Create EXT Filesystem with Larger Inode Ratio
Create EXT Filesystem with Larger Inode Ratio

Besides, you can also use the -T flag to specify how the filesystem is going to be used so that mkfs.ext4 can choose optimal filesystem parameters for that use including the bytes-per-inode ratio. The configuration file /etc/mke2fs.conf contains the different supported usage types and many other configurations parameters.

In the following examples, the command tells that the file system will be used to create and/or store largefile and largefile4 which offer more relevant ratios of one inode every 1 MiB and 4 MiB respectively.

$ sudo mkfs.ext4 -T largefile /dev/device
OR
$ sudo mkfs.ext4 -T largefile4 /dev/device

To check the inode usage of a file system, run the df command with the -i option (the -T option shows the file system type).

$ df -i
OR
$ df -iT
Check File System Inode Usage in Linux
Check File System Inode Usage in Linux

We would like to know your thoughts about this article. Use the feedback form below to reach us. For more information, see the mkfs.ext4 manpage.

If this article helped, with someone on your team.

TecMint Weekly Newsletter
Get the Learn Linux 7 Days Crash Course free when you join 34,000+ Linux professionals reading every Thursday.
Check your email for a magic link to get started.
Something went wrong. Please try again.
TecMint has been free for 14 years. Help keep it that way.
Google AI Overviews and tools like ChatGPT have cut into search traffic for independent tech sites like TecMint. Running this site costs over $2,000 every month for hosting, infrastructure, and paying authors to keep the content accurate and tested.

If this article helped you solve a problem, consider buying a coffee. It helps keep TecMint free, supports the authors, and keeps the project going.
☕ Buy Me a Coffee
Ravi Saive
I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

10 Comments

Leave a Reply
  1. How I can increase the inode number of external storage without formatting a drive?

    (OS: CentOD 7)

    Thanks in advance.

    Reply
  2. Are there any filesystems that have dynamically allocated inode storage that can be increased on-demand, instead of fixed inode storage, which in this day and age seems quaint and kind of dumb?

    Reply
  3. Never mind I got it when I reread “When creating a new file system on a partition, you can use the -i option to set the bytes-per-inode (bytes/inode ratio), the larger the bytes-per-inode ratio, the fewer inodes will be created.”

    Reply
  4. Is the number after i a ratio or an integer. For example, will the number create exactly that amount of inodes or a number divided by the size of the disk?

    Reply
      • @Rafael,

        An inode is a data structure that is used to store information of files on your Linux system. The number of inodes shows the number of files and directories you have on the system.

        Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Free Course
Get a free Linux course before you go.
Subscribe to TecMint Weekly and get the Learn Linux 7 Days Crash Course free. Read by 34,000+ Linux professionals every Thursday.
Something went wrong. Please try again.
Check your email for a magic link to get started.