Reputation: 1019
How to calclulate max inode number used for -N
option in mkfx.ext4
, basing on LV/device size?
On example below, I tried some bigger -N
numbers when creating filesystem on ~500MB LV and it fails on 4207000 and on 4017000 works already. How to calculate max?
# mkfs.ext4 -m 0 -b 4096 -N 4207000 /dev/mapper/testvg-testlv
mke2fs 1.42.9 (28-Dec-2013)
mkfs.ext4: inode_size (128) * inodes_count (4207000) too big for a
filesystem with 130048 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
# mkfs.ext4 -m 0 -b 4096 -N 4017000 /dev/mapper/testvg-testlv
mke2fs 1.42.9 (28-Dec-2013)
warning: 160 blocks unused.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
4018656 inodes, 129888 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
123 block groups
1056 blocks per group, 1056 fragments per group
32672 inodes per group
Superblock backups stored on blocks:
1056, 3168, 5280, 7392, 9504, 26400, 28512, 51744, 85536
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): mkfs.ext4: Could not allocate block in ext2 filesystem
while trying to create journal
Upvotes: 1
Views: 2203
Reputation: 2093
Block Size = 4096
Blocks = 130048
Partition Size = (Block Size * Blocks) = 532676608 ( ~508Mb )
inode_size = 128
inode_ratio = 16834
max inodes = (Partition Size / inode_ratio) * inode_size = 4050291
Hope that helps
Upvotes: 1