Page 1 of 1

ext2 clarification

Posted: Sat Nov 20, 2010 4:26 pm
by sancho1980
Hi

In the ext2 wiki (http://wiki.osdev.org/Ext2), I found the following:
Locating the Block Group Descriptor Table
The table is located in the block immediately following the Superblock. So if the block size (determined from a field in the superblock) is 1024 bytes per block, the Block Group Descriptor Table will begin at block 2.
How does that make sense? If the superblock is 1024 bytes and the block descriptor table "is located in the block immediately following the Superblock", then I'd say it must begin at block 1, no??
The it goes on to say:
For any other block size, it will begin at block 1. Remember that blocks are numbered starting at 0, and that block numbers don't usually correspond to physical block addresses.
So even if the block size was 512 bytes, it would start at block 1, i.e. in the middle of the superblock (which with its 1024 bytes would occupy 2 blocks)???

Re: ext2 clarification

Posted: Sat Nov 20, 2010 4:47 pm
by piranha
How does that make sense? If the superblock is 1024 bytes and the block descriptor table "is located in the block immediately following the Superblock", then I'd say it must begin at block 1, no??
The superblock starts at an offset of 1024 bytes. If the block size is 1024 then it starts at block 1.

As for your second question, I believe it works like this:

You can only have block sizes of 1024, 2048, 4096, etc. Therefore, since the superblock starts at 1024 bytes in, any other block size than 1024 will result in the superblock ending before the start of the next block, block 1. The super block is then contained in block 0, from bytes 1024 to 2048. You cant have 512 sized blocks.

-JL