etx4文件系统和最大inode计算

时间:2020-02-28 10:33:44

标签: linux centos ext4

如何根据LV /设备大小来计算-Nmkfx.ext4选项的最大索引节点数?

在下面的示例中,我在〜500MB LV上创建文件系统时尝试使用更大的-N数字,但在4207000和4017000上已经失败了。如何计算最大值?

# 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

1 个答案:

答案 0 :(得分:1)

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

希望有帮助

相关问题