Cannot create filesystem with requested number of inodes while setting up superblock

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6

Issue

The following error is printed while creating filesystem with higher number of inodes

Cannot create filesystem with requested number of inodes while setting up superblock

Resolution

Create filesystem with bytes-per-inode ratio greater then blocksize of the filesystem.

Root Cause

  • bytes-per-inode specifies 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 change this ratio on a filesystem after it is created, so be careful deciding the correct value for this parameter.

  • Resizing a filesystem changes the number of inodes to maintain bytes-per-inode ratio.

Diagnostic Steps

  • Try to create filesystem with inodes 1203111968
# mkfs.ext4 -N 1203111968  /dev/vg_vol/lv_vol
mke2fs 1.41.12 (17-May-2010)
/dev/vg_vol/lv_vol: Cannot create filesystem with requested number of inodes while setting up superblock
  • Size of 400 Gb filesystem in bytes
400 * 1024 * 1024 * 1024 = 429496729600 bytes
  • Calculate bytes/inode ratio
429496729600÷1203111968 = 356.988161554
  • 356.988161554 is less then 4096 so not able to create the filesystem.

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.