2019-06-06 10:42:47

by Wang Jianchao

[permalink] [raw]
Subject: [HELP] What are the allocated blocks on a newly created ext4 fs ?

Dear all

After I newly created a ext4 fs and check the mb_group,

#group: free frags first [ 2^0 2^1 2^2 2^3 2^4 2^5 2^6 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]
#0 : 23513 1 9255 [ 1 0 0 1 1 0 1 1 1 1 0 1 1 2 ]
#1 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
^^^^
#2 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
#3 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
#4 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
#5 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
#6 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
#7 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
#8 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
#9 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
#10 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
#11 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]

There are some bgs that have 1024 blocks allocated. What are they for ?

Many thanks in advance
Jianchao


2019-06-06 12:59:25

by Artem Blagodarenko

[permalink] [raw]
Subject: Re: [HELP] What are the allocated blocks on a newly created ext4 fs ?

Hello Jianchao,

Not enought input data to give an answer. It depends on mkfs options. For example, if flex_bg option is enabled, then several block groups are tied together as one logical block group; the bitmap spaces and the inode table space in the first block group, so some groups are not totally free just after FS creating.

> On 6 Jun 2019, at 13:41, Jianchao Wang <[email protected]> wrote:
>
> Dear all
>
> After I newly created a ext4 fs and check the mb_group,
>
> #group: free frags first [ 2^0 2^1 2^2 2^3 2^4 2^5 2^6 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]
> #0 : 23513 1 9255 [ 1 0 0 1 1 0 1 1 1 1 0 1 1 2 ]
> #1 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
> ^^^^
> #2 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
> #3 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
> #4 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
> #5 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
> #6 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
> #7 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
> #8 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
> #9 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
> #10 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
> #11 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>
> There are some bgs that have 1024 blocks allocated. What are they for ?
>
BTW, I don’t see from mb_group output why 1024 blocks allocated in group #1
> Many thanks in advance
> Jianchao

Best regards,
Artem Blagodarenko.

2019-06-10 03:26:19

by Wang Jianchao

[permalink] [raw]
Subject: Re: [HELP] What are the allocated blocks on a newly created ext4 fs ?

Hi Artem

Thanks so much for your help.

On 2019/6/6 20:32, Artem Blagodarenko wrote:
> Hello Jianchao,
>
> Not enought input data to give an answer. It depends on mkfs options. For example, if flex_bg option is enabled, then several block groups are tied together as one logical block group; the bitmap spaces and the inode table space in the first block group, so some groups are not totally free just after FS creating.

In my environment, there are 16 bgs per flex_bg.
The bitmaps and inode table .etc should lay on the first bg of every flex_bg.
So I can see there are about 8223 blocks allocated in the 1st bg of every flex_bg.

But as you can see in the output of mb_groups, there are some bgs which get allocated about 1024 blocks.

I have out figured out what are they for.

Thanks
Jianchao

>
>> On 6 Jun 2019, at 13:41, Jianchao Wang <[email protected]> wrote:
>>
>> Dear all
>>
>> After I newly created a ext4 fs and check the mb_group,
>>
>> #group: free frags first [ 2^0 2^1 2^2 2^3 2^4 2^5 2^6 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]
>> #0 : 23513 1 9255 [ 1 0 0 1 1 0 1 1 1 1 0 1 1 2 ]
>> #1 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
>> ^^^^
>> #2 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>> #3 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
>> #4 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>> #5 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
>> #6 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>> #7 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
>> #8 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>> #9 : 31743 1 1025 [ 1 1 1 1 1 1 1 1 1 1 0 1 1 3 ]
>> #10 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>> #11 : 32768 1 0 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 4 ]
>>
>> There are some bgs that have 1024 blocks allocated. What are they for ?
>>
> BTW, I don’t see from mb_group output why 1024 blocks allocated in group #1
>> Many thanks in advance
>> Jianchao
>
> Best regards,
> Artem Blagodarenko.
>

2019-06-10 03:41:32

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [HELP] What are the allocated blocks on a newly created ext4 fs ?

On Mon, Jun 10, 2019 at 11:25:47AM +0800, Jianchao Wang wrote:
> Hi Artem
>
> Thanks so much for your help.
>
> On 2019/6/6 20:32, Artem Blagodarenko wrote:
> > Hello Jianchao,
> >
> > Not enought input data to give an answer. It depends on mkfs options. For example, if flex_bg option is enabled, then several block groups are tied together as one logical block group; the bitmap spaces and the inode table space in the first block group, so some groups are not totally free just after FS creating.
>
> In my environment, there are 16 bgs per flex_bg.
> The bitmaps and inode table .etc should lay on the first bg of every flex_bg.
> So I can see there are about 8223 blocks allocated in the 1st bg of every flex_bg.
>
> But as you can see in the output of mb_groups, there are some bgs
> which get allocated about 1024 blocks.
>
> I have out figured out what are they for.

The best way to understand what the blocks are used for is to use the
dumpe2fs program, e.g:

% mke2fs -t ext4 -Fq /tmp/foo.img 1T
% dumpe2fs /tmp/foo.img | more
...
Group 0: (Blocks 0-32767) csum 0xe6f6 [ITABLE_ZEROED]
Primary superblock at 0, Group descriptors at 1-128
Reserved GDT blocks at 129-1152
Block bitmap at 1153 (+1153), csum 0xb033995a
Inode bitmap at 1169 (+1169), csum 0x108d3d73
Inode table at 1185-1696 (+1185)
23385 free blocks, 8181 free inodes, 2 directories, 8181 unused inodes
Free blocks: 9383-32767
Free inodes: 12-8192
Group 1: (Blocks 32768-65535) csum 0xe50b [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Backup superblock at 32768, Group descriptors at 32769-32896
Reserved GDT blocks at 32897-33920
Block bitmap at 1154 (bg #0 + 1154), csum 0x00000000
Inode bitmap at 1170 (bg #0 + 1170), csum 0x00000000
Inode table at 1697-2208 (bg #0 + 1697)
31615 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 33921-65535
Free inodes: 8193-16384
...


Regards,

- Ted

2019-06-10 03:55:09

by Wang Jianchao

[permalink] [raw]
Subject: Re: [HELP] What are the allocated blocks on a newly created ext4 fs ?

On 2019/6/10 11:39, Theodore Ts'o wrote:
> On Mon, Jun 10, 2019 at 11:25:47AM +0800, Jianchao Wang wrote:
>> Hi Artem
>>
>> Thanks so much for your help.
>>
>> On 2019/6/6 20:32, Artem Blagodarenko wrote:
>>> Hello Jianchao,
>>>
>>> Not enought input data to give an answer. It depends on mkfs options. For example, if flex_bg option is enabled, then several block groups are tied together as one logical block group; the bitmap spaces and the inode table space in the first block group, so some groups are not totally free just after FS creating.
>>
>> In my environment, there are 16 bgs per flex_bg.
>> The bitmaps and inode table .etc should lay on the first bg of every flex_bg.
>> So I can see there are about 8223 blocks allocated in the 1st bg of every flex_bg.
>>
>> But as you can see in the output of mb_groups, there are some bgs
>> which get allocated about 1024 blocks.
>>
>> I have out figured out what are they for.
>
> The best way to understand what the blocks are used for is to use the
> dumpe2fs program, e.g:
>
> % mke2fs -t ext4 -Fq /tmp/foo.img 1T
> % dumpe2fs /tmp/foo.img | more
> ...
> Group 0: (Blocks 0-32767) csum 0xe6f6 [ITABLE_ZEROED]
> Primary superblock at 0, Group descriptors at 1-128
> Reserved GDT blocks at 129-1152
> Block bitmap at 1153 (+1153), csum 0xb033995a
> Inode bitmap at 1169 (+1169), csum 0x108d3d73
> Inode table at 1185-1696 (+1185)
> 23385 free blocks, 8181 free inodes, 2 directories, 8181 unused inodes
> Free blocks: 9383-32767
> Free inodes: 12-8192
> Group 1: (Blocks 32768-65535) csum 0xe50b [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> Backup superblock at 32768, Group descriptors at 32769-32896
> Reserved GDT blocks at 32897-33920
> Block bitmap at 1154 (bg #0 + 1154), csum 0x00000000
> Inode bitmap at 1170 (bg #0 + 1170), csum 0x00000000
> Inode table at 1697-2208 (bg #0 + 1697)
> 31615 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> Free blocks: 33921-65535
> Free inodes: 8193-16384
> ...
>

Hi Ted

Many thanks for your help

These allocated blocks should be the reserved GDT blocks.

Many thanks again.
Jianchao