3

I was brushing up and diving deeper into filesystem anatomy and in numerous resources it is said to be a requirement that the very first superblock start at an offset of 1024 bytes. I started looking for any sort of documentation as to why 1024 was chosen, it just seemed pretty arbitrary. All I could find was the following:

"For the special case of block group 0, the first 1024 bytes are unused, to allow for the installation of x86 boot sectors and other oddities. The superblock will start at offset 1024 bytes, whichever block that happens to be (usually 0). However, if for some reason the block size = 1024, then block 0 is marked in use and the superblock goes in block 1. For all other block groups, there is no padding."

Ext4 Disk Layout

I figured this region had something to do with the later stages of grub, so I did some more digging and came across this article:

Details of GRUB on the PC

Which, from the DOS compatibility region section, states that the entire first "cylinder" is reserved, which can be up to 63 sectors, which is far more than a 1024 byte offset, so now i'm just confused.

My Question:

Can someone please explain, from byte 0 to the first superblock of an EXT filesystem, how a disk is laid out?

2

The master boot record (MBR) at the beginning of a disk contains only 446 bytes of code, so it is tiny and cannot do much. Therefore, a common booting technique is to do what is called "chain loading," where the MBR loads code at the beginning of the active partition and jumps to that code. By leaving the first two sectors free, the EXT file system allows the beginning of the partition to be used for such chain-loading code, when your EXT file system is on the active partition. More information on how this booting process works can be found here:

http://wiki.osdev.org/Boot_Sequence#The_Traditional_Way

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.