Command Prompt - Fix Issues with your Boot Records

Together we've learned how to use system recovery tools to fix system problems. We are at the end of the System Recovery and Command Prompt series and, what better way to finish but with a tutorial that shows how to repair master boot problems?

Bootrec.exe - the Ultimate Repair Tool for Boot Problems

If your Windows 7 is having trouble booting properly and Startup Repair didn't fix the problem, it's worth trying the Bootrec.exe tool by running in the Command Prompt. This utility was designed to troubleshoot and repair startup issues in Windows 7.

As mentioned in the Overview of System Recovery Options for Windows 7 article, boot from your Windows 7 Setup DVD or a System Repair Disc and launch Command Prompt. Once launched, you can start using the Bootrec.exe tool.

Type bootrec.exe and hit Enter to see the available options for this tool. As you can see in the picture below, there are four parameters available : /FixMbr, /FixBoot, /ScanOs and /RebuildBcd.

Command Prompt

Let's see how they work.

NOTE: Most boot problems can be solved using the bootrec utility, but this tool does not guarantee success in every scenario.

Repairing the Master Boot Record

The first parameter is /FixMbr. It allows you to repair a corrupted or damaged Master Boot Record(MBR). The Master Boot Record is the first sector of your drive that basically tells the BIOS where to look for the operating system on your computer. Usually, you will use this parameter when you meet the error message: 'Operating System not found, Error loading operating system, Missing operating system or Invalid partition table'.

Simply type bootrec.exe /fixmbr and press Enter.

Command Prompt

A confirmation message is displayed when the repair is done.

Writing a New Boot Sector

The /FixBoot parameter writes a new boot sector to the system partition by using a boot sector that is compatible with Windows 7. This option is used in one of the following situations:

  • the boot sector has been replaced with a non-standard Windows Vista or Windows 7 boot sector;
  • the boot sector is damaged;
  • an earlier Windows operating system has been installed after Windows 7 was installed.

Type bootrec.exe /fixboot and then press Enter.

Command Prompt

A confirmation message is displayed when the operation is completed.

Rebuilding the Master Boot Record

The Boot Configuration Data (BCD) contains a detailed list of what is supposed to load at startup. Microsoft indicates that a boot error can also be caused by missing or damaged files in the BCD. The last parameter, /rebuildbcd, can be very useful when you must fix some errors by completely rebuilding the BCD. A sample of how this parameter works can be viewed in the picture below.

Command Prompt

Add Missing Windows 7 Installations to the Boot Configuration Data

The /ScanOs option scans all disks for any Windows Vista and Windows 7 installations that are not currently included in the Boot Configuration Data (BCD) table which the operating system uses, and displays them.

In the capture below, you can see a scan process that didn't find any operating system installation.

Command Prompt

If the bootrec /scanos command gives you a result, similar to the one you see below, you will be able to continue the repair process. You will be able to get your lost Windows 7 back into the secure BCD table and make it bootable again.

Command Prompt

First of all you have to clean Master Boot Record (MBR) by using bootrec /fixmbr as in an earlier section. Next, type bootsect.exe /nt60 all /force and press Enter. The /nt60 parameter applies the master boot code that is compatible with BOOTMGR. The all argument updates the master boot code on all partitions. The /force parameter forcibly dismounts the volume(s) during the boot code update so that Bootsect.exe utilily cannot gain exclusive volume access.

Command Prompt

Now you've created a new MBR and told it to use Windows 7 boot loader to load Windows 7 installation from the hard disk.

Conclusion

As you can from this tutorial, Bootrec.exe is a very powerful tool for fixing problems with your computer's boot records. With this tutorial we conclude our series of articles on the Command Prompt and System Recovery tools. Hopefully they will be useful to you when the going gets tough. If you have any questions, don't hesitate to leave a comment.