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?
Answer
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:
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.
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.
Comments
Post a Comment