RHEL: Extending the maximum inode count on a ext2/ext3/ext4 filesystem

# Tested on RHEL 6 & 7


# An inode is a data structure that contains information about a file or directory. Inodes
# rarely get used up when the file system has available space. Nevertheless, this may
# happen when there is a large amount of small files or empty files because each file or
# directory will use an inode.

# Once the filesystem created it is not possible to modify the number of inodes so one
# should carefully decide the correct value for this parameter.

# In addition, we should take into account that the value of bytes per inode shouldn't be
# smaller than the blocksize of the filesystem, otherwise there will be more inodes on the
# filesystem than those that will be ever used.

# Inode number may be set by specifying the total number of inodes during filesystem
# creation, "-N", or by indicating a bytes/inode ratio, "-i".


# For a small logical volume like following one:

lvs /dev/rootvg/lv_test
   LV      VG     Attr       LSize
   lv_test rootvg -wi-a----- 512.00m


# I'll create a ext3 filesystem using different bytes/inode ratio. Pay attention to the
# space "lost" on the filesystem for inode purposes:

mkfs.ext3 /dev/rootvg/lv_test
   mke2fs 1.41.12 (17-May-2010)
   Filesystem label=
   OS type: Linux
   Block size=4096 (log=2)
   Fragment size=4096 (log=2)
   Stride=0 blocks, Stripe width=0 blocks
   32768 inodes, 131072 blocks
   6553 blocks (5.00%) reserved for the super user
   First data block=0
   Maximum filesystem blocks=134217728
   4 block groups
   32768 blocks per group, 32768 fragments per group
   8192 inodes per group
   Superblock backups stored on blocks:
           32768, 98304

df -h /test
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/mapper/rootvg-lv_test
                         504M   17M  462M   4% /test



mkfs.ext3 -i 4096 /dev/rootvg/lv_test
   mke2fs 1.41.12 (17-May-2010)
   Filesystem label=
   OS type: Linux
   Block size=4096 (log=2)
   Fragment size=4096 (log=2)
   Stride=0 blocks, Stripe width=0 blocks
   131072 inodes, 131072 blocks
   6553 blocks (5.00%) reserved for the super user
   First data block=0
   Maximum filesystem blocks=134217728
   4 block groups
   32768 blocks per group, 32768 fragments per group
   32768 inodes per group
   Superblock backups stored on blocks:
           32768, 98304

df -h /test
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/mapper/rootvg-lv_test
                         480M   17M  438M   4% /test



mkfs.ext3 -i 1024 /dev/rootvg/lv_test
   mke2fs 1.41.12 (17-May-2010)
   Filesystem label=
   OS type: Linux
   Block size=4096 (log=2)
   Fragment size=4096 (log=2)
   Stride=0 blocks, Stripe width=0 blocks
   524288 inodes, 131072 blocks
   6553 blocks (5.00%) reserved for the super user
   First data block=0
   Maximum filesystem blocks=135272448
   16 block groups
   8592 blocks per group, 8592 fragments per group
   32768 inodes per group
   Superblock backups stored on blocks:
           8592, 25776, 42960, 60144, 77328

df -h /test
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/mapper/rootvg-lv_test
                         384M   19M  340M   6% /test
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
systemd Auto-restart a crashed service in systemd
Viewed 3049 times since Fri, Jan 17, 2020
SSL HowTo: Decode CSR
Viewed 4913 times since Mon, Feb 18, 2019
Tunnel SSH Connections Over SSL Using ‘Stunnel’ On Debian 7 / Ubuntu 13.10
Viewed 3164 times since Fri, Sep 28, 2018
How to encrypt a partition with DM-Crypt LUKS on Linux
Viewed 8134 times since Fri, Jul 13, 2018
Applescript: Run or Call a Shell Script
Viewed 4135 times since Tue, Aug 6, 2019
Using Official Redhat DVD as repository
Viewed 11087 times since Mon, Oct 29, 2018
Linux - How to perform I/O performance test with dd command
Viewed 5939 times since Fri, Jun 8, 2018
Linux - How to unlock and reset user’s account
Viewed 4330 times since Fri, Jun 8, 2018
RHEL: Allowing users to ’su’ to "root" / Allowing ’root’ to login directly to the system using ’ssh’
Viewed 2774 times since Sat, Jun 2, 2018
HP-UX - Stunnel Configuration
Viewed 2341 times since Fri, Sep 28, 2018