Page 1 of 1
MBR vs Boot Record
Posted: Thu Jan 01, 2009 11:14 am
by Dhaann
Hello everybody,
I've written a boot record that works. But I want to write a MBR (Master Boot Record).
What's the difference between them? And I wondered how to write a boot record (or mbr) to a hard drive.
Thanks!
Re: MBR vs Boot Record
Posted: Thu Jan 01, 2009 12:24 pm
by Troy Martin
The MBR is sector 0 of a hard drive, but it has 64 bytes somewhere in it to describe the partitions of the drive, see wikipedia:
http://en.wikipedia.org/wiki/Master_boot_record
Re: MBR vs Boot Record
Posted: Sun Jan 04, 2009 6:53 am
by Love4Boobies
Dhaann wrote:Hello everybody,
I've written a boot record that works. But I want to write a MBR (Master Boot Record).
What's the difference between them? And I wondered how to write a boot record (or mbr) to a hard drive.
Thanks!
In your case, they are probably one and the same thing. However, you might one to read on the
GPT, which is (U)EFI's way of describing partitions.
Re: MBR vs Boot Record
Posted: Sun Jan 04, 2009 9:40 am
by quok
Love4Boobies wrote:Dhaann wrote:Hello everybody,
I've written a boot record that works. But I want to write a MBR (Master Boot Record).
What's the difference between them? And I wondered how to write a boot record (or mbr) to a hard drive.
Thanks!
In your case, they are probably one and the same thing. However, you might one to read on the
GPT, which is (U)EFI's way of describing partitions.
GPT partitioning schemes are, in my opinion, much nicer than the old MBR scheme. Booting from them on a BIOS based system however, isn't entirely supported by BIOS systems. It's certainly possible (GRUB 2 can do it), but many of the solutions out there that accomplish such a thing are gross hacks that hark back to the days of MBR and hiding data in the sectors between partitions. According to the GPT spec (inside the UEFI 2.1 spec, see section 5), such spaces between partitions aren't needed, but some vendors (Apple, for instance) create them anyway. According to
Apple Tech Note TN2166, this space is 128MB on Apple systems!
Back to booting a BIOS system from a GPT partition, I believe the UEFI spec does contain a solution for this (which nobody happens to then follow). MBRs are still there, of course, and you can nest MBR partitions inside GPT partitions, but I don't remember that part of the spec very well.
The UEFI spec is freely available from the UEFI website, although IIRC you'll have to sign up for a free account.
Re: MBR vs Boot Record
Posted: Sat Jan 10, 2009 7:32 am
by Love4Boobies
I forgot to mention this, but there's also the notion of EBR (Extended Boot Record). On legacy MBR systems, multiple EBR can coexist in the system to define your extended partitions. Normally, only 4 partitions fit in the MBR - these are called primary partitions. After that, the MBR has to point to an EBR (which pretty much has the same partition table format but the last two entries are not used) which defines an extended partition and a link to the next EBR, if any. Think of this as a chain of extended partitions.
Re: MBR vs Boot Record
Posted: Thu Jan 22, 2009 10:55 am
by abachler
The MBR's job is to load the boot record of the active partition and execute it. Additionally, for compatibility reasons, the MBR should move itself to 0x0600:0x0000 and load the partition boot code to 0x07c0:0x0000
Re: MBR vs Boot Record
Posted: Thu Jan 22, 2009 1:11 pm
by Love4Boobies
That's not due to compatibility reasons. It's called chainloading and it doesn't really matter where you do it. 0600H is where Microsoft does it. 0500H is where my first stage boot loader (MBR) does it - that's the first spot of free memory, right after the IVT and the BDA. The reason for doing this is so that you can load the boot sector (not boot record) at 0000:7C00H; you wouldn't like to read over already execution code, would you?
EDIT: Oh, and btw - Microsoft does it at 0000:0600H, not 0600:0000H.