Skip to content Skip to main navigation Skip to footer

How to Rebuild the Boot Sector for Windows Vista and Windows 7/8.x/10

When the Windows system (booting) partition's boot sector is corrupted or otherwise contains invalid code for the version of Windows on the partition, it must be repaired before the partition will boot properly. Since the Windows installer updates the boot sector of the system partition during installation, this problem usually occurs when the Windows booting files are relocated from their install partition to an alternate partition or when installing an older version of Windows on a system with a newer version already installed.

Two example scenarios that can cause this problem and the resulting error messages are described below:

  • Scenario 1: Windows XP was installed. A new partition was created and formatted using XP to install Windows 7 in a dual-boot setup. Windows 7 was then installed using default options, placing its booting files onto the XP partition in a standard Microsoft dual-boot configuration. Later, the user installs BootIt BM and decides to move the Windows 7 booting files to the Windows 7 partition to separate it from XP. After moving the files and attempting to boot into Windows 7, the following error message is displayed:

    NTLDR is missing
    Press Ctrl+Alt+Del to restart


    This happens because the partition's boot sector was not updated when Windows 7 was installed and still contains the XP code to load ntldr (Windows Vista and later use bootmgr). Note: This type of problem can be avoided by formatting the destination partition(s) as part of the installation process.

  • Scenario 2: Using BootIt BM as a partition manager, two NTFS partitions are created and formatted for installing Windows 7. The first partition is set active. Windows 7 is installed normally to the second partition, placing its booting files onto the first partition (similar to the default method used by Windows 7 when installing to an unpartitioned drive). Later, the user needs to remove the first partition. The booting files are moved to the Windows 7 partition and it's set active. Attempting to boot Windows 7 results in the following error:

    This partition does not contain an operating system.
    If you are about to install a new OS then insert the
    installation diskette into drive A:

    Press any key to run the BIOS bootstrap loader...


    This happens because the partition's boot sector code contains the default BootIt BM code and not the code required to boot into Windows. When installing Windows, the installer will only update the boot sector of the system (booting) partition. In this case, the first partition's boot sector was updated, while the second one wasn't. Note: This type of problem can be avoided by formatting the destination partition(s) as part of the installation process.

These types of errors cannot always be repaired by doing a Startup Repair using the Windows DVD, Repair Disc or Recovery Drive. In any case, whether or not a Startup Repair was attempted, the boot sector can be updated manually by using the bootsect.exe program available on the following Windows media:

  • Windows Vista DVD
  • Windows 7 DVD
  • Windows 8 DVD
  • Windows 7 System Repair Disc
  • Windows 8 System Repair Disc or Recovery Drive
  • Windows 10 Recovery Drive or installation media
  • WinPE disc based on Vista, Windows 7/8.x/10 (e.g. VistaPE, TBWinRE, TBWinPE)

The bootsect.exe program is also available in Windows 8.x/10 installations. 

If possible, it's recommended to use the version of bootsect that matches (or is newer than) the version of Windows being repaired. For example, use the Windows 7 version to repair a Windows 7 or Vista boot sector. However, either version should work in most cases. Also note that you need to use a compatible version when running in Windows. For example, you can't run the 64-bit version of bootsect (located on the 64-bit installation media) while running 32-bit Windows.

Using bootsect.exe from Windows

The boot sector repair can be performed directly from Windows if the following requirements are met:

  • The computer can successfully boot into a different Windows installation.

  • The partition needing the repair must be available to Windows so it can be assigned a drive letter.

  • A version of Windows (e.g. 8.x/10) or Windows media is used that contains the bootsect program in a directly accessible state. The Windows installation DVDs or flash drives are good for this since bootsect.exe is located in the \Boot folder on the media. The Repair Discs, Recovery Drives, and other builds may have the program packed into the WIM file (accessible only when booted). 

  • The bootsect program must be run from an Administrator Command Prompt.

For example, using Scenario 1, the computer could be booted into XP with the Windows 7 partition assigned F:. The bootsect program could then be run from the Windows 7 32-bit DVD, as follows:

  1. Open an Explorer window (Start >> My Computer or Start >> Computer) and note the drive letters assigned to the DVD drive and the Windows 7 partition. In this example, D: will be used for the DVD drive and F: will be used for the Windows 7 partition.

  2. Insert the Windows 7 DVD (if it auto-plays, close the window).

  3. Start the Command Prompt (Start >> All Programs >> Accessories >> Command Prompt). In versions of Windows with UAC enabled, right-click on Command Prompt and select Run as administrator.

  4. Run the following command at the prompt (make sure to use the correct drive letters for your system):

    D:\boot\bootsect /nt60 F:

  5. The computer should now be able to successfully boot the Windows 7 partition.

 

Using bootsect.exe from the Windows boot media

Though the actual steps vary a little between the different versions of the boot media, the instructions are generally the same:

  1. Boot the computer using the appropriate Windows boot media.

  2. Open a Command Prompt window:

    • Windows 7/8.x/10 DVD: Press Shift-F10 (or follow alternate instructions below).

    • Windows Vista DVD, Windows 7 DVD, Windows 7 System Repair Disc: If prompted, select the language, time, and keyboard options. Select to Repair your computer, select to Use recovery tools..., and then start the Command Prompt. Make sure to cancel any automatic repairs.

      Note: Booting a system with the wrong version of the Windows media (e.g. using a Windows 7 x64 DVD on a Windows 7 x86 system) may result in it reporting that it's not supported or not compatible and block you from proceeding to the System Recovery Options menu. To get around this, click the Load Drivers button, click OK on the Add Drivers window, browse to X:\Windows\System32, scroll through the list and find cmd (you may need to type *.exe into the File name box and press ENTER if programs aren't being displayed), then right-click on cmd and select Open. To get the other windows out of the way, click Cancel on the Open box and on the Add Drivers box.

    • Windows 8.x/10 DVD, System Repair Disc, Recovery Media: If prompted, select the language, time, and keyboard options. If booting the installation media, click the Repair your computer link. Click Troubleshoot, then Advanced options, then Command Prompt.

    • TBWinRE, TBWinPE, WinPE-based builds, etc.: Depending on the build configuration, it may boot directly to the Command Prompt window. Otherwise, the Command Prompt should be available in TBLauncher, the taskbar menu, or by running cmd.


  3. Determine the drive letters assigned to the DVD drive and the Windows partition requiring the repair. Note that this partition must be accessible and be assigned a letter (it can't be a hidden partition). In this example, D: will be used for the DVD drive and F: will be used for the Windows 7 partition.

  4. Run the following command at the prompt (make sure to use the correct drive letters for your system):

    D:\boot\bootsect /nt60 F:

    Note: When booted to versions of the Windows 7/8.x/10 boot media, bootsect.exe is available in the path and can just be referenced by name (i.e. bootsect /nt60 F:).

  5. The computer should now be able to successfully boot the Windows 7 partition.

 


Additional Information:

Using the "/force" option on locked or "in use" partitions

In certain situations, bootsect may display a message similar to the following:

Updated NTFS filesystem bootcode. The update may be unreliable since the volume could not be locked during the update:
   Access is denied.

Bootcode was successfully updated on all targeted volumes.

This happens if bootsect can't lock the partition or the partition is detected as being used. Note that this error also occurs in WinPE and is not limited to partitions in a booted Windows system.

In many cases, the repair is actually written to the boot sector successfully and no further action is required. However, if needed, you can specify the /force option, which causes a forced dismount of the partition if the standard lock attempt fails. When using this option from WinPE it shouldn't cause any problems, but caution should be used when using it in Windows since it can cause unexpected behavior as all open file handles on the partition are invalidated.

Example: D:\boot\bootsect /nt60 F: /force


Using the "/nt52" option to repair XP boot sectors

Bootsect can also be used to repair the XP boot sector and offers an alternative to using the XP Recovery Console and fixboot. Usage is the same as shown in this article, just use /nt52 instead of /nt60.

Example: D:\boot\bootsect /nt52 F:


Additional bootsect options

More information on using bootsect.exe can be found by running bootsect /help at the Command Prompt. Relevant information can also be found in this Microsoft KB article.

Example: D:\boot\bootsect /help


Using bootrec.exe instead of bootsect.exe

The bootrec.exe program is available when booted to the Windows Vista or later installation or WinPE-based boot media. This program can also repair the boot sector code, but is limited to the system (active) partition only. As a result, this method will not work from a booted Windows system.

Example: D:\boot\bootrec /fixboot

Was This Article Helpful?

0