12

According to Microsoft here is what Bootrec /FIXBOOT does:

"This option writes a new boot sector to the system partition by using a boot sector that's compatible with Windows Vista or Windows 7"

And this is what Bootrec /FIXMBR does:

"This option writes a Windows 7 or Windows Vista-compatible MBR to the system partition"

Now isn't the MBR just a type of boot sector? What other types of boot sectors would it fix? I'm confused when I would use one over the other- isn't mbr the only boot sector windows uses?

red888
  • 4,069
  • 16
  • 58
  • 104
  • 4
    As I understand it, MBR = First sector on the entire drive and Boot Sector is the first sector in a partition. Your BIOS reads the MBR first then gets pointed to the Boot Sector of the system partition which controls the loading of that partion or will present you with a menu so you can choose another partition to boot off. I think LILO / NTLDR etc reside in the boot sector? – Mark Innsbruck Owen Jul 07 '14 at 14:25
  • Mark, you're correct - you should answer. – Ryan Ries Jul 07 '14 at 14:37
  • "MBR = First sector on the entire drive and Boot Sector is the first sector in a partition", but the MBR is a type of boot sector. What type of boot sectors are the ones at the beginning of a partition? Are those the "Volume Boot Records"? – red888 Jul 07 '14 at 14:42
  • 1
    The other thing that confuses me is that it says both commands write to the system partition. So we're talking about the same partition (and I believe you can have only one system partition). When would I ever write a boot sector to the system partition that wasn't an MBR type of boot sector? In Windows land does boot sector have a specifically different meaning than MBR, because everything I read says a MBR is just a type of a boot sector. – red888 Jul 07 '14 at 14:58

2 Answers2

14

This turned out to be a very interesting question. There are lots of links out there on this topic but they are ambiguous in describing the difference/relationship between the two. Best description I've found of the hard drive configuration for a Windows OS is this one: http://www.ntfs.com/hard-disk-basics.htm.

It appears that MBR and Partition Table are in the same sector on a drive. The MBR is "smaller" in that it is the very first thing on the drive, that then uses the partition table to continue the boot process to a specific OS. The two command options effectively fix different links in the boot chain:

/fixmbr replaces the information and small executable that reads the partition table to find where the OS may be located. So this exists on any drive that has been formatted and effectively exists to read the next little bit on the hard drive that tells where the/an OS is supposed to be located. In essence, this is not necessarily a Windows-specific item.

/fixboot replaces the next part - the entry in the partition table that points to where the actual loadable executable is located for the OS. So this is fixing the next link in the chain of the boot process. This command does create a windows-specific result in that it reminds the hard drive where to find Windows in particular.

Mary
  • 565
  • 5
  • 10
1

/FixMBR writes Disk's Boot Sector (commonly called MBR), while /FixBoot writes Partition's Boot Sector (commonly called VBR or PBR).

All this boils down to how Windows boots on BIOS (non-UEFI) systems. As we know, due to limitations of BIOS firmware (it runs in real-mode and can't access more than 1 MiB of RAM), it cannot load and execute the actual OS (e.g. Windows or Linux kernel). So the system bootstraps execution process in stages from small-sized code to larger one. That's why we have bootloaders.

In first (or zero) stage BIOS loads the first sector of selected disk in RAM and starts execution at predefined offset. It happens on all BIOS compatible systems, irrespective of the installed OS. So the first sector involved in boot(strapp)ing is called Boot Sector.

Now isn't the MBR just a type of boot sector?

Yes. MBR is the boot sector we most commonly interact with. /FixMBR writes "to the system partition" is not correct. MBR is written to the first sector of the disk (even on GPT disks).

Isn't MBR the only boot sector Windows uses?

No. It also uses VBR/PBR.

Depending on the installed bootloader and OS, there might exist more boot sectors on partitions too. In case of Windows, executable code in MBR finds Active Partition or Boot Partition (Windows calls it System Partition) in Partition Table (also part of the MBR) and executes that partition's boot sector (VBR) which contains BootMgr code. By now VBR is large enough to understand filesystem structure, so it executes \bootmgr file (placed in root of the Active Partition), which reads its configuration from BCD file (usually \Boot\BCD) and runs winload.exe (or shows a selection menu if BCD contains multiple entries), which runs Windows kernel. See more details here.

But not all OSes boot alike. GRUB (popular boot loader in Linux world), for instance, installs itself to MBR which executes the next stage(s) written to few sectors right after MBR. It reads its configuration from /grub/grub.cfg (placed in /boot partition, which might be different than Linux installation partition mounted at /) and loads Linux kernel (or shows a selection menu if grub.cfg contains multiple entries). GRUB and other bootloaders like SYSLINUX can also be written to VBR.

On a multi-boot system grub.cfg usually includes an entry for Windows, so it's the GRUB (not Windows) MBR which executes BootMgr in VBR (even if it's not on the Active Partition), when Windows entry is selected by user. Going further deeper, GRUB can be configured to directly run \bootmgr executable file (by using ntldr command instead of default chainloader), entirely bypassing VBR executable code.

Once you decide to come back to Windows' native booting, run BootRec /FixMBR, and GRUB is gone. Inversely we can also make Windows' BootMgr chainload GRUB by modifying BCD using third party tools like EasyBCD or BootICE, or using Windows' bcdedit tool to add a new entry.

Rewriting VBR is usually not needed, except if you accidentally (or intentionally) write e.g. GRUB to VBR of Windows' Active Partition. In this case BootRec /FixBoot is also required to successfully resume Windows' native boot chain.

Note that both of the above commands just rewrite the executable part of MBR/VBR, other parts are untouched e.g. Partition Table in MBR. Like Partition Table in MBR describes partition layout, BIOS Parameter Block in NTFS VBR describes filesystem layout. /FixBoot cannot fix problems in BPB.
For instance if you replace the Windows Active Partition, or move the installation to another disk so that the starting sector number of the partition changes, Windows won't boot, even if you fix MBR/VBR and recreate/fix BCD entries (using bcdboot/bcdedit, which is also required if the disk identifier/signature changes because that's hard-coded in BCD store entries). In one of the BPB fields the number of first partition sector is hard-coded, which needs to be fixed. You can see details here.


RESOURCES:

Irfan Latif
  • 121
  • 1
  • 2
  • 6