Bootrec /FIXBOOT vs Bootrec /FIXMBR

Solution 1:

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.

Solution 2:

/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:

  • Master Boot Record
  • Volume Boot Record
  • PC Boot Process and PC Boot Sequence
  • Advanced troubleshooting for Windows boot problems
  • The GRUB MBR
  • How to boot into Windows 7 when grub is installed in the Windows partition?
  • Where to find the VBR on the /dev/sda1 partition?