How to Increase Disk Inode Number in Linux

Increase disk inode number in Linux and seamlessly enhance the number of files you can create on your system. When the number of inodes in your system is alarming, get the same increased by adopting necessary measures.

With an inode number, you’re looking at a type of unique number that exists on every file of any Unix-based system. The inode number represents a physical file or a form of data. The term inode is something that packs all the information about a specific file apart from the designated name or the actual data that sits inside. The same is unique throughout the hierarchical file system.

As soon as you create a file in Linux, a corresponding inode number gets attached to it. Inodes are an integral part of the file creation process. It directly affects the frequency. The more inodes available, the more is the number of files you can create.

But what if all the available inodes get drained? The answer is pretty evident that your Kernel will fail to build any new file system. That is when increasing the inode number becomes crucial.

Increasing disk inode number in Linux sounds too much of a technical term to deal with; however, it is not always the same. Read the following article and understand the most flexible approach.

Pre Requisites

Before learning how to increase disk inode number in Linux, take your time and make sure you’ve access to the following:

  • A fully operational Linux system
  • Sudo privileges

Getting the Inode Number of a File in Linux

Finding the number of inodes within a file on your Linux system is not as challenging as many consider it to be. 

Launch the Terminal 

Invoke the ls or stat command.

How to Increase Disk Inode Number in Linux

Having talked about the essential resources already, let’s now jump right into the tutorial and help you learn how to increase disk Inode number in Linux.

Creating a New File System

Whenever you’re trying to create a fresh system file within a specific partition, you can always invoke the –i flag together with the desired command. It will set the value for bytes/inode ratio. 

Remember, the more the value for bytes per inode ratio, the less will be the number of inodes to get created.

Suppose you wish to create an  EXT4 file system in a manner that corresponds to a lesser bytes/inode ratio value. In that case, you’ll need to proceed as follows:

Launch the Terminal by using the “Ctrl+Alt+T” key combination

Run the mkfs command in the following format:

creating a new file

Things to Keep in Mind While Creating a New File System

Once you’re done creating a file system, there is no other way to alter the byte/inode ratio value apart from formatting it. For that reason, an attempt to resize the filesystem will change the number of inodes to keep the ratio constant.

Specifying the Usage

Post creation, the next task is defining how the created filesystem will be used. It will make sure that the mkfs.ext4 command can choose the desired parameters, even including the value representing the ratio, bytes per inode. The process is simple; just employ the -T flag alongside the mkfs.ext4 command.

$ sudo mks.ext4 -T [CFile] /dev/device
dev device

In case you wonder where the user types and configuration parameters reside, the answer is a configuration file. It looks something like /etc/mke2fs.conf (might be different, depending on the type of filesystem you’re working on)

Coming to the command mentioned above, the filesystem is used to create or store a utility named CFile. It offers a more suitable ratio of inode, the frequency being one in every 1 MiB or 2 MiB and 4 MiB or 6 MiB.

Checking the Usage of Inode

After you increase disk inode number in Linux, make sure to dedicate a few minutes to monitor the corresponding usage. Doing that won’t trouble you much as you’ll only require the df command.

The command for checking inode usage should look something like this:

$ df -i
$ df -iT
inode usage in linux

Here, the application of the T flag alongside the -i flag is to help instruct the system for displaying the file system type.

Alternative Approach For Increasing Disk Inode Number in Linux:

While using the mkfs.ext4 command alongside the i flag reflects the manual process of overwriting the bytes/inode ratio and upgrading the concerned number; you can opt for an alternative approach. The method involves increasing the disk capacity.

With that, I’m done guiding you on how to increase disk inode number in Linux. Although you’ve got the option to increase the disk capacity entirely, there does exist an interesting manual process to adopt. 

If this guide helped you, please share it.

Leave a Reply
Related Posts