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!
MBR vs Boot Record
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: MBR vs Boot Record
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
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: MBR vs Boot Record
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.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!
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: MBR vs Boot Record
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!Love4Boobies wrote: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.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!
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.
Last edited by quok on Thu Jan 22, 2009 10:57 am, edited 1 time in total.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: MBR vs Boot Record
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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: MBR vs Boot Record
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
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: MBR vs Boot Record
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.
EDIT: Oh, and btw - Microsoft does it at 0000:0600H, not 0600:0000H.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]