2

Partitioning tools(for example fdisk) tend to leave a 2047 sector(LBA 1-2047, 1048064 bytes) between the MBR and first partition. On LBA 0 there is a MBR and from LBA 2048 starts the first partition. GRUB should keep it's stage 1.5 data in this gap and Linux software-RAID should keep it's superblock in this area at least in case of some superblock versions(e.g. version 1.2), but what else may be stored on this gap? Is this area used for anything else?

  • Have you taken a look at the Wikipedia page on MBR? en.wikipedia.org/wiki/Master_boot_record – slm Mar 8 '14 at 4:54
  • @slm yes, but there seemed to be no information regarding the gap after the MBR and before the first partition. – Martin Mar 8 '14 at 12:52
  • This depends on the system and bootloader in use (grub vs uboot, etc). Safe to say in whatever bootloader is used that the gap will contain a mix of empty space and code for the bootloader and perhaps some non-volatile configuration information for the bootloader. – casey Mar 10 '14 at 0:53
  • I've been partitioning by harddisks with fdisk for a long time, and all my old MBR partitions start at sector 63 (I just checked). Since when does fdisk start the first partition at 2048? That's just wasteful. – dirkt Jul 4 '17 at 6:52
2

The first half KiB (512 bytes) are used for the Master Boot Record. It tells about where primary partitions are and more.

The first part of the disk, 2048 sectors (is the equivalent 1MiB) is not part of any partition. It used to be a smaller part but since newer computers use bigger drives the newer software needs to be able to address it all. But they were still using 32bits processors at the time the bigger drives were arriving. So within those 32bits the whole drive needs to be accessible, so that meant: Bigger blocks per address. It used to be 63 sectors (31.5Kib). Thats not a good number to do binary math on (read: not a power of 2) and too small for the larger drives.

  • sorry, I meant 1MiB not 1KiB of free space between the MBR and first partition. In other words LBA 1 to 2048. Still, what is this gap used for? – Martin Mar 8 '14 at 12:50
1

I don't know if that's exactly what you mean, but every partition has also a boot sector, that doesn't have to be filled.

This image explains it better, than any amount of words: enter image description here

Conversely, the space for stage 1 and 2 may be quite arbitrary. The FreeBSD Handbook explains it in more detail. So what you see there, may be just unused stage loader space.


I Should clarify: the space for stage 0 and stage 1 are determined by a list of jump positions. Hence, sometimes some space if left empty if the boot loader uses more code in some other location.

0

According to this page, the space Martin mentioned was usually unused by OS. Sometimes maybe used by some boot managers like GRUB.

  • 1
    It is encouraged that you provide a summary of linked content, so if the link becomes invalid, you answer does not become invalid. – John Militer Jul 4 '17 at 3:47

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.