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 .

performance - Single Threaded Qaud Core v.s Hyper-Threading Dual Core

Let's say we have two CPUs, One is Quad Core 3.2 Ghz with 4 Cores, and We have a Dual Core 3.2 Ghz with 2 Cores with 2 threads in each Core (Hyper-Threading). My assumption as a programmer will be, the 4 cores 4 threads should perform faster than 2 cores 4 threads since the second CPU needs to switch between threads in order to emulate 4 cores while the first one doesn't need to perform such switching as each core can perform independently and individually. I want to confirm that my assumption is true, if not please explain why one is better than the other. Answer I do believe thats true - since hyper threading does share some elements - specifically the main execution resources, you'll be able to run 4 full threads at once, rather than waiting for those resources to be freed up. The point of HT is to get better performance with a smaller use of die area - your quad core would generally be a bigger chip - say almost twice as large, than a non HT dual core chip, while a HT...

freeze - How do I stop windows 8.1 from freezing when the screen locks

This happens to me on a regular basis if I leave the computer for upwards of 10 minutes. It didnt do so at first but started after a couple of days. This is possibly related to further windows updates although nothing seems to tie in obviously when looking at my update history. I have to hold the power button in to power off. If the screens have switched off aswell they wont come back on, if they haven't I see the login picture and can move the mouse pointer but nothing happens and no combination of keyboard mashes or mouse clicks lets me see the login prompt. In the event log (type event viewer into the start menu) under system before every Critical problem (me powering down the machine without restarting) I get distributedCOM errors talking about this guid: "The server {BF6C1E47-86EC-4194-9CE5-13C15DCB2001} did not register with DCOM within the required timeout." I also get the same error for this 1B1F472E-3221-4826-97DB-2C2324D389AE. This seems to be a common theme and...