No free inodes left on Ext3/Ext4 filesystem

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (All Versions)
  • EXT3, EXT4 file systems

Issue

  • My file system has plenty of space left, but I'm getting errors about a lack of inodes. How do I detect and fix this?

Resolution

  • A new file system can be created with a higher inode to space ratio by using the -i option in mke2fs command:
-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.
  • Determine what is creating all the small files, and delete them if that is practical.

  • Add additional space to the device. The ratio will stay the same, but additional inodes will be added to the file system.

Root Cause

  • Each file and directory uses an inode. When the filesystem is created, a specific block of inodes is created for that file system. If many small files are present, this can cause the pool of inodes to be consumed prematurely.

  • The number of used/free inodes can be seen here:

# df -i /dev/(device)
  • Additional information about inode size and pool can be seen by using dumpe2fs:
# dumpe2fs /dev/(device) |grep ^Inode 

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments