{"id":556,"date":"2011-11-04T19:16:00","date_gmt":"2011-11-05T02:16:00","guid":{"rendered":"https:\/\/kb.terabyteunlimited.com\/kb-articles\/how-to-rebuild-the-boot-sector-for-windows-vista-and-windows-7-8-x-10\/"},"modified":"2026-01-07T20:22:19","modified_gmt":"2026-01-08T04:22:19","slug":"how-to-rebuild-the-boot-sector-for-windows-vista-and-windows-7-8-x-10","status":"publish","type":"lsvr_kba","link":"https:\/\/www.terabyteunlimited.com\/kb\/kb-articles\/how-to-rebuild-the-boot-sector-for-windows-vista-and-windows-7-8-x-10\/","title":{"rendered":"How to Rebuild the Boot Sector for Windows Vista and Windows 7\/8.x\/10\/11"},"content":{"rendered":"<p>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.<\/p>\r\n<p>Two example scenarios that can cause this problem and the resulting error messages are described below:<\/p>\r\n<ul>\r\n\t<li><strong>Scenario 1:<\/strong> 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:<br \/>\r\n<br \/>\r\n<span style=\"color: #ff0000;\">NTLDR is missing<br \/>\r\nPress Ctrl+Alt+Del to restart <\/span><br \/>\r\n<br \/>\r\nThis happens because the partition's boot sector was not updated when Windows 7 was installed and still contains the XP code to load <strong>ntldr<\/strong> (Windows Vista and later use <strong>bootmgr<\/strong>). Note: This type of problem can be avoided by formatting the destination partition(s) as part of the installation process.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li><strong>Scenario 2:<\/strong> 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:<br \/>\r\n<br \/>\r\n<span style=\"color: #ff0000;\">This partition does not contain an operating system.<br \/>\r\nIf you are about to install a new OS then insert the<br \/>\r\ninstallation diskette into drive A:<br \/>\r\n<br \/>\r\nPress any key to run the BIOS bootstrap loader...<\/span> <br \/>\r\n<br \/>\r\nThis 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.<\/li>\r\n<\/ul>\r\n<p>These types of errors cannot always be repaired by doing a Startup Repair using the Windows DVD, Repair Disc or Recovery Drive.\u00a0In any case, whether or not a Startup Repair was attempted, the boot sector can be updated manually by using the <strong>bootsect.exe<\/strong> program available on the following Windows media:<\/p>\r\n<ul>\r\n\t<li>Windows Vista DVD<\/li>\r\n\t<li>Windows 7 DVD<\/li>\r\n\t<li>Windows 8 DVD<\/li>\r\n\t<li>Windows 7 System Repair Disc<\/li>\r\n\t<li>Windows 8 System Repair Disc or Recovery Drive<\/li>\r\n\t<li>Windows 10\u00a0Recovery Drive or installation media<\/li>\r\n\t<li>Windows 11 Recovery Drive or installation media<\/li>\r\n\t<li>WinPE disc based on Vista, Windows 7\/8.x\/10\/11 (e.g. VistaPE, <a href=\"https:\/\/www.terabyteunlimited.com\/howto\/tbwinre_tutorial\/\" target=\"_blank\" rel=\"noopener\">TBWinRE<\/a>, <a href=\"https:\/\/www.terabyteunlimited.com\/howto\/tbwinpe_tutorial\/\" target=\"_blank\" rel=\"noopener\">TBWinPE<\/a>)<\/li>\r\n<\/ul>\r\n<p>The bootsect.exe program is also available\u00a0in Windows 8.x\/10\/11 installations.\u00a0<\/p>\r\n<p>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.<br \/>\r\n<br \/>\r\n<\/p>\r\n<p><strong><span style=\"color: #005858;\">Using bootsect.exe from Windows<\/span><\/strong><\/p>\r\n<p>The boot sector repair can be performed directly from Windows if the following requirements are met:<\/p>\r\n<ul>\r\n\t<li>The computer can successfully boot into a different Windows installation.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>The partition needing the repair must be available to Windows so it can be assigned a drive letter.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>A version of Windows (e.g. 8.x\/10\/11) or\u00a0Windows 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 &#92;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).\u00a0<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>The bootsect program must be run from an Administrator Command Prompt.<\/li>\r\n<\/ul>\r\n<p>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:<\/p>\r\n<ol>\r\n\t<li>Open an Explorer window (<em>Start &gt;&gt; My Computer<\/em> or <em>Start &gt;&gt; Computer<\/em>) and note the drive letters assigned to the DVD drive and the Windows 7 partition. In this example, <strong>D:<\/strong> will be used for the DVD drive and <strong>F:<\/strong> will be used for the Windows 7 partition.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>Insert the Windows 7 DVD (if it auto-plays, close the window).<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>Start the Command Prompt (<em>Start &gt;&gt; All Programs &gt;&gt; Accessories &gt;&gt; Command Prompt<\/em>). In versions of Windows with UAC enabled, right-click on Command Prompt and select <em>Run as administrator<\/em>.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>Run the following command at the prompt (make sure to use the correct drive letters for your system):<br \/>\r\n<br \/>\r\n<span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>D:&#92;boot&#92;bootsect \/nt60 F:<\/strong><\/span><br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>The computer should now be able to successfully boot the Windows 7 partition.<\/li>\r\n<\/ol>\r\n<p>&nbsp;<\/p>\r\n<p><strong><span style=\"color: #005858;\">Using bootsect.exe from the Windows boot media<\/span><\/strong><\/p>\r\n<p>Though the actual steps vary a little between the different versions of the boot media, the instructions are generally the same:<\/p>\r\n<ol>\r\n\t<li>Boot the computer using the appropriate Windows boot media.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>Open a Command Prompt window:<br \/>\r\n<br \/>\r\n<ul>\r\n\t<li><strong>Windows 7\/8.x\/10\/11 DVD:<\/strong> Press <em>Shift-F10<\/em> (or follow alternate instructions below).<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li><strong>Windows Vista DVD, Windows 7 DVD, Windows 7 System Repair Disc: <\/strong>If prompted, select the language, time, and keyboard options. Select to <strong>Repair your computer<\/strong>, select to <strong>Use recovery tools...<\/strong>, and then start the Command Prompt. Make sure to cancel any automatic repairs.<br \/>\r\n<br \/>\r\n<strong>Note:<\/strong> 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 <em>System Recovery Options<\/em> menu. To get around this, click the <strong>Load Drivers<\/strong> button, click <strong>OK<\/strong> on the <em>Add Drivers<\/em> window, browse to <strong>X:&#92;Windows&#92;System32<\/strong>, scroll through the list and find <strong>cmd<\/strong> (you may need to type<strong> *.exe<\/strong> into the <em>File name<\/em> box and press ENTER if programs aren't being displayed), then right-click on <strong>cmd<\/strong> and select <strong>Open<\/strong>. To get the other windows out of the way, click <strong>Cancel<\/strong> on the <em>Open<\/em> box and on the <em>Add Drivers<\/em> box.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li><strong>Windows 8.x\/10\/11 DVD, System Repair Disc, Recovery Media:<\/strong> If prompted, select the language, time, and keyboard options. If booting the installation media, click the <strong>Repair your computer<\/strong> link. Click <strong>Troubleshoot<\/strong>, then <strong>Advanced options<\/strong>, then <strong>Command Prompt<\/strong>.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li><strong>TBWinRE, TBWinPE, WinPE-based builds, etc.:<\/strong> 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 <strong>cmd<\/strong>.<br \/>\r\n<br \/>\r\n<br \/>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li>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, <strong>D:<\/strong> will be used for the DVD drive and <strong>F:<\/strong> will be used for the Windows 7 partition.<br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>Run the following command at the prompt (make sure to use the correct drive letters for your system):<br \/>\r\n<br \/>\r\n<span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>D:&#92;boot&#92;bootsect \/nt60 F:<\/strong><\/span><br \/>\r\n<br \/>\r\n<strong>Note:<\/strong> When booted to versions of the Windows 7\/8.x\/10\/11 boot media, <strong>bootsect.exe<\/strong> is available in the path and can just be referenced by name (i.e. <span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>bootsect \/nt60 F:<\/strong><\/span>). <br \/>\r\n<br \/>\r\n<\/li>\r\n\t<li>The computer should now be able to successfully boot the Windows 7 partition.<\/li>\r\n<\/ol>\r\n<p>&nbsp;<\/p>\r\n<hr \/>\r\n<p><strong><span style=\"color: #ff5500;\">Additional Information:<\/span><\/strong><\/p>\r\n<p><strong><span style=\"color: #005858;\">Using the \"\/force\" option on locked or \"in use\" partitions<\/span><\/strong><\/p>\r\n<p>In certain situations, bootsect may display a message similar to the following:<\/p>\r\n<p><span style=\"color: #ff0000;\">Updated NTFS filesystem bootcode. The update may be unreliable since the volume could not be locked during the update:<br \/>\r\n\u00a0\u00a0\u00a0Access is denied.<br \/>\r\n<br \/>\r\nBootcode was successfully updated on all targeted volumes.<\/span><\/p>\r\n<p>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.<\/p>\r\n<p>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 <strong>\/force<\/strong> 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.<\/p>\r\n<p>Example: <span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>D:&#92;boot&#92;bootsect \/nt60 F: \/force<br \/>\r\n<\/strong><\/span><br \/>\r\n<br \/>\r\n<\/p>\r\n<p><strong><span style=\"color: #005858;\">Using the \"\/nt52\" option to repair XP boot sectors<\/span><\/strong><\/p>\r\n<p>Bootsect can also be used to repair the XP boot sector and offers an alternative to using the XP Recovery Console and <em>fixboot<\/em>. Usage is the same as shown in this article, just use <strong>\/nt52<\/strong> instead of <strong>\/nt60<\/strong>.<\/p>\r\n<p>Example: <span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>D:&#92;boot&#92;bootsect \/nt52 F:<\/strong><\/span><br \/>\r\n<br \/>\r\n<br \/>\r\n<\/p>\r\n<p><strong><span style=\"color: #005858;\">Additional bootsect options<\/span><\/strong><\/p>\r\n<p>More information on using <strong>bootsect.exe<\/strong> can be found by running <strong>bootsect \/help<\/strong> at the Command Prompt. Relevant information can also be found in this <a href=\"http:\/\/support.microsoft.com\/kb\/919529\" target=\"_blank\" rel=\"noopener\">Microsoft KB article<\/a>.<\/p>\r\n<p>Example: <span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>D:&#92;boot&#92;bootsect \/help<\/strong><\/span><br \/>\r\n<br \/>\r\n<br \/>\r\n<\/p>\r\n<p><strong><span style=\"color: #005858;\">Using bootrec.exe instead of bootsect.exe<\/span><\/strong><\/p>\r\n<p>The <strong>bootrec.exe <\/strong>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.<\/p>\r\n<p>Example: <span style=\"color: #008800; font-family: Courier New, Courier, monospace;\"><strong>D:&#92;boot&#92;bootrec \/fixboot<\/strong><\/span><\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>When the Windows system (booting) partition&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"lsvr_kba_cat":[1817],"lsvr_kba_tag":[2127,2142,2140,2141,2139],"class_list":["post-556","lsvr_kba","type-lsvr_kba","status-publish","hentry","lsvr_kba_cat-vista-win7-8-x-10","lsvr_kba_tag-windows","lsvr_kba_tag-windows-10","lsvr_kba_tag-windows-7","lsvr_kba_tag-windows-8-x","lsvr_kba_tag-windows-vista"],"_links":{"self":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba"}],"about":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/types\/lsvr_kba"}],"author":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":5,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/556\/revisions"}],"predecessor-version":[{"id":7281,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/556\/revisions\/7281"}],"wp:attachment":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"lsvr_kba_cat","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_cat?post=556"},{"taxonomy":"lsvr_kba_tag","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_tag?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}