0

For studying, I assigned a size of 100M and formatted the drive as ext2.

This is the output of dumpe2fs:

[root@ ext2fs]# dumpe2fs /dev/sda2
dumpe2fs 1.42.9 (28-Dec-2013)
Filesystem volume name: <none>
Last mounted on: /home
Filesystem UUID: dd4a8792-84b0-48a3-8356-682229114afd
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super
Filesystem flags: signed_directory_hash 
Default mount options: user_xattr acl
Filesystem state: not clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 25688
Block count: 102400
Reserved block count: 5120
Free blocks: 97577
Free inodes: 25662
First block: 1
Block size: 1024
Fragment size: 1024
Reserved GDT blocks: 256
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 1976
***Inode blocks per group: 247***
Filesystem created: Tue Dec 12 10:08:16 2017
Last mount time: Wed Dec 13 09:23:29 2017
Last write time: Wed Dec 13 09:23:29 2017
Mount count: 4
Maximum mount count: -1
Last checked: Tue Dec 12 10:08:16 2017
Check interval: 0 (<none>)
Lifetime writes: 58 kB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Default directory hash: half_md4
Directory Hash Seed: a24eb501-5513-40fe-afeb-04b93ae8d11f

I wonder how "Inode Blocks per group" is calculated, which is 247 in this case.

1 Answer 1

1

The inodes are just packed in blocks, both have sizes that are powers of two, so they fit exactly. From these numbers:

Block size: 1024
Inodes per group: 1976
Inode size: 128

We get

1024 B/block 
--------------  = 8 inodes/block    
 128 B/inode

1976 inodes/group 
------------------- = 247 (inode) blocks/group
   8 inodes/block

which was the expected result.

I think the inodes are also distributed evenly over all block groups, so the ratios (inodes/group) / (total inodes) and (blocks/group) / (total blocks) should also be equal (up to rounding, since the last block group isn't full).

2
  • I know this calculating process,1976*128/1024 = 247,then how does Inodes per group(1976) calculate?
    – gaofeng
    Commented Dec 13, 2017 at 13:24
  • Your question says >"I wonder how is "Inode Blocks per group",which is 247 in this case,calculated?" @ilkkachu wrote an answer for it. Go ahead accept this answer. You can create new question for above comment. Commented Dec 24, 2017 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .