Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I don't fully understand the concept of a boot sector, I was hoping someone could clear this up for me.

If you have two hard drives, with an OS installed on each, does each drive have its own boot sector? Does each drive need an MBR partition?

I've got Linux and Windows on two separate drives. I've had issues when installing Linux and grub, and now I've finally decided to use the Windows bootloader to start up. Would Windows have gotten rid of grub when i used /fixmbr or does it stay there on the boot sector of the other drive?

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted

Wil's answer is vaguely correct, but isn't technically accurate. Yes, a drive does not need an MBR. Without one, you will be unable to boot from that drive, and you will not be able to create partitions on that drive. BUT...

The term Master Boot Record is often used to refer to two things -- it is properly only the first, and commonly misapplied to the second:

  1. A location, specifically, the first 512-byte sector of a partitioned data storage device ("LBA Sector 0"). This location holds the first 440 bytes of boot loader code (the first-stage boot loader) and the primary partition table. See Wikipedia's MBR article for details on the structure of a typical MBR.

  2. The boot loader code stored in that location. In a BIOS system, this is the first code executed when the BIOS boots from a drive. See MBRs and system bootstrapping and first-stage boot loader: on i386 systems, this code chainloads the second-stage boot loader, stored on the volume boot record of the active partition, which does the actual booting of the operating system.

The Volume Boot Record or partition boot sector is the first sector of a partition and is where an operating system installed to that partition will store its main bootstrapping code. A VBR is also used on non-partitioned data storage devices (floppy disks, USB flash drives, or even harddrives used in non-partitioned roles).

Mulitple-boot systems use a boot manager (eg, Grub). A boot manager places its own the bootloader code into the MBR and provides a menu from which a user can choose an OS to boot. (In technical terms, the user is choosing which second-stage bootloader to use.)


So, to answer your questions directly:

  • Two hard drives with an OS installed on each will each have its own MBR.

    • Both MBRs will contain at least one partition.
    • Each partition on those harddrives will have its own VBR. The partitions that contain operating system installations will store their second-stage boot loaders in those VBRs; any partitions that are data-only will (probably) not have valid boot code in their VBR.
    • If this system boots, at least one of those MBRs will contain a valid first-stage boot loader, but it is only necessary for the drive from which the BIOS attempts to boot.

  • When you installed Linux to your second drive, it probably wrote Grub's first-stage boot loader to the MBR of the Windows drive. It may have also written the first-stage boot loader to the MBR of its own drive, but if the BIOS never attempts to boot from the Linux drive, you'll never notice. Similarly, when you use /fixmbr, Windows rewrites the first-stage boot loader on its system drive's MBR.

    • I honestly don't know if Win-7's Bootrec.exe utility will also write to the MBRs of other drives. It probably has the capability to do so, but probably isn't the default action.
    • I also don't know if Ubuntu 9.04's installer would install Grub to the MBRs of both drives by default. It's possible to do so by hand if desired. In some situations it would be a good thing -- if you were to disconnect the Windows drive and try to boot from the Linux drive, you wouldn't boot if Grub's first-stage boot code wasn't present.
share|improve this answer
    
Thanks for that very detailed answer :-)... I was always wondering why MBR was being used for two different meanings, and now I know haha –  GiH Feb 13 '10 at 19:10
1  
@GiH you're welcome. thanks for asking this question; it can serve as a basic intro to MBRs & bootloaders for future readers. –  quack quixote Feb 13 '10 at 19:30
    
do you have a source for "The term Master Boot Record is often used to refer to two things -- it is properly only the first, and commonly misapplied to the second:" I'm sure it's right, and i've read it somewhere.. but interesting if you have a source for that. Also, since here's a term for bootloader, is there a term for the non-bootloader part of the MBR? And when it comes to GPT, does GPT include bootloader and partition table, and what terminology distinguishes between GPT and the partition table? –  barlop May 29 '13 at 4:07
add comment

A drive does not need a MBR, however, without one, you will not be able to boot from that drive.

For starters, the machine will boot to whatever disk that the BIOS is told to. That, is the only disk which needs a MBR (This is on BIOS based machines e.g. most on the market, not EFI).

Having an MBR will basically tell the machine that the drive is bootable (and not return the dreaded "No disk or disk error" or similar message), the bootloader will then be loaded.

When the bootloader is loaded, it will basically do what it is instructed to, this can be to load other bootloaders (For example, Grub loading Windows boot loader) or operating systems - For example, you can choose drive/partition.

So, You only need to have the MBR (and Bootloader) on the actual boot drive.

share|improve this answer
    
Ok, but is it possible that both my drives have an MBR since I had grub working before? Basically what I'm trying to figure out is if my Linux drive is wasting space on an MBR because I'm not using grub, or when I installed the Windows bootloader, did it get rid of grub and the MBR? Sorry if my question is confusing... –  GiH Feb 10 '10 at 19:39
1  
You can only have one MBR as it is not so much a file, but a location - If you installed a different OS on a different drive, it is possible that you still have it on the other drive, but it is so insignificantly small, I really would not be worried (we are talking about a few hundred bytes (I think max is ~500), if that, on a drive with many billions of bytes!). However, it is possible that you still have the grub files - but, again, it is very small. –  William Hilsum Feb 10 '10 at 19:48
3  
@GiH, re: wasting space -- no, the MBR also provides the partition table for the drive, so that space is reserved (not used by the OS) whether it contains a valid boot record or not. you can think of it as a tiny amount of overhead for your filesystems; in comparison to modern hard drive capacities, the amount of "wasted" space is too small to worry about. –  quack quixote Feb 10 '10 at 20:25
add comment

MBR (Master Boot Record) is the first sector on which it is possible to write on. It has a fixed location and size (very small), so you can have only one MBR by disk.

MBR is the first sector read in boot sequence after bios is loaded. It can be used to boot one operating system or to load a boot loader like grub or lilo in order to choose which system to load.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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