How to Increase Disk Inode Number in Linux?

An inode is an entry in inode table, containing information ( the metadata ) about a regular file and directory. An inode is a data structure on a traditional Unix-style file system such as ext3 or ext4.

 

Inode number also called index number, it consists following attributes.

  • File types ( executable, block special etc )
  • Permissions ( read, write etc )
  • UID ( Owner )
  • GID ( Group )
  • FileSize
  • Timestamps including last access, last modification and last inode number change.
  • File deletion time
  • Number of links ( soft/hard )
  • Location of ile on harddisk.

 

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

 

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.

 

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.

 

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 large file 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

 

Having trouble while "Increase Disk Inode Number in Linux" – Our Experts are available 24/7.

Was this answer helpful? 0 Users Found This Useful (0 Votes)