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

Use Google instead of Bing with Windows 10 search

I want to use Google Chrome and Google search instead of Bing when I search in Windows 10. Google Chrome is launched when I click on web, but it's Bing search. (My default search engine on Google and Edge is http://www.google.com ) I haven't found how to configure that. Someone can help me ? Answer There is no way to change the default in Cortana itself but you can redirect it in Chrome. You said that it opens the results in the Chrome browser but it used Bing search right? There's a Chrome extension now that will redirect Bing to Google, DuckDuckGo, or Yahoo , whichever you prefer. More information on that in the second link.

linux - Using an index to make grep faster?

I find myself grepping the same codebase over and over. While it works great, each command takes about 10 seconds, so I am thinking about ways to make it faster. So can grep use some sort of index? I understand an index probably won't help for complicated regexps, but I use mostly very simple patters. Does an indexer exist for this case? EDIT: I know about ctags and the like, but I would like to do full-text search. Answer what about cscope , does this match your shoes? Allows searching code for: all references to a symbol global definitions functions called by a function functions calling a function text string regular expression pattern a file files including a file

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 - CentOs 7.1 - Install Tomcat 8

I am using this tutorial as a setup reference to getting a Tomcat 8 running on CentOs 7.1 , but after typing: [root@localhost tomcat]# sudo systemctl start tomcat I get the error: Job for tomcat.service failed. See 'systemctl status tomcat.service' and 'journalctl -xn' for details. systemctl status tomcat.service prints the following: [root@localhost tomcat]# systemctl status tomcat.service tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; disabled) Active: failed (Result: exit-code) since Wed 2015-11-25 16:54:33 CET; 1min 19s ago Process: 45873 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC) Nov 25 16:54:33 localhost.localdomain systemd[1]: Starting Apache Tomcat Web Application Container... Nov 25 16:54:33 localhost.localdomain systemd[1]: tomcat.service: control process exited, code=exited status=203 Nov 25 16:54:33 localhost.localdomain systemd[1]: Failed to start Apache Tomcat Web App...