Skip to main content

windows 7 - How do boot sectors and multiple drives works?


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:




  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.




Comments

Popular Posts

How do I transmit a single hexadecimal value serial data in PuTTY using an Alt code?

I am trying to sent a specific hexadecimal value across a serial COM port using PuTTY. Specifically, I want to send the hex codes 9C, B6, FC, and 8B. I have looked up the Alt codes for these and they are 156, 182, 252, and 139 respectively. However, whenever I input the Alt codes, a preceding hex value of C2 is sent before 9C, B6, and 8B so the values that are sent are C2 9C, C2 B6, and C2 8B. The value for FC is changed to C3 FC. Why are these values being placed before the hex value and why is FC being changed altogether? To me, it seems like there is a problem internally converting the Alt code to hex. Is there a way to directly input hex values without using Alt codes in PuTTY? Answer What you're seeing is just ordinary text character set conversion. As far as PuTTY is concerned, you are typing (and reading) text , not raw binary data, therefore it has to convert the text to bytes in whatever configured character set before sending it over the wire. In other words, when y...

linux - Extract/save a mail attachment using bash

Using normal bash tools (ie, built-ins or commonly-available command-line tools), is it possible, and how to extract/save attachments on emails? For example, say I have a nightly report which arrives via email but is a zip archive of several log files. I want to save all those zips into a backup directory. How would I accomplish that? Answer If you're aiming for portability, beware that there are several different versions of mail(1) and mailx(1) . There's a POSIX mailx command, but with very few requirements. And none of the implementations I have seem to parse attachments anyway. You might have the mpack package . Its munpack command saves all parts of a MIME message into separate files, then all you have to do is save the interesting parts and clean up the rest. There's also metamail . An equivalent of munpack is metamail -wy .

ubuntu - Why does my USB hdd returns SG_IO: bad/missing sense data?

I am able to boot and run commands from external USB hdd; the message in question appears for about 45 seconds then booting continues. GRUB2 is installed on internal HDD. When choosing to boot directly to /dev/sdb the message doesn't appear, however boot time is about the same as booting to internal HDD. /dev/sdb: Timing cached reads: 1018 MB in 2.00 seconds = 508.97 MB/sec Timing buffered disk reads: 80 MB in 3.03 seconds = 26.37 MB/sec pfeiffep@de:~$ sudo hdparm -i /dev/sdb /dev/sdb: SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 10 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 HDIO_GET_IDENTITY failed: Invalid argument Gparted correctly identifies the drive as SAMSUNG MP0402H. Any ideas how to remedy the HDIO & SG_IO messages?

Desktop reboots itself on sleep or hibernate

I have been using an ASUS M2NPV-VM motherboard for main home desktop workstation, operating Windows Vista x64. This computer has right from day one not been able to enter hibernate or standby; after Windows performs its final actions and brings the machine down, it would automatically revive itself for a reboot. Updating to the second latest BIOS (1201)has not helped (the latest BIOS revision would induce video refresh problems rendering it unusable). I have been reading related discussions on incidents similar to mine to no avail of a true workable solution. They appear to be more speculative guesses rather than actual knowledge on the inner workings of motherboard hardware. Does anybody have any electronic engineering experience on PC energy-saving standards to provide a more informed opinion how to go about getting this to work? More stories: this motherboard could not even reboot properly the first thing i used it. It was due to refresh rate of the onboard GPU, which had no influe...