Windows Boot Repair

From Devpit
Jump to: navigation, search

If you copy C: to a new boot filesystem, some incantations are required to load the bootstrap code onto the new disk. Naturally, you need to use a copy method that preserves NTFS ACLs and attributes. For example, a backup and restore through Bacula preserves these, if using the windows agent (not samba).

Post-install Windows seems unable to reload boot code on a secondary disk, so you'll need installation media. It appears that booting from Windows 10 installation media can be used for this procedure to fix older versions. Fancier features like automatic system repair do not appear to work when crossing versions. The following procedure will rewrite the boot code that transcends files.

  • Check to see if /boot exists. If it's missing, Windows had a secret system partition. You can omit the partition and copy /boot and /bootmgr from a working machine with an identical version of Windows. Or see below if you want to make the secret partition. Sourcing these files from a running computer will work, but you will have to tell it to skip bcd and bcd.log, which is fine. The following will make a new bcd file anyway, and the log is disposable.
  • Boot installation media from USB, DVD, or PXE.
  • Open command prompt (Shift-F10).
  • Set the new partition active:
diskpart
  list volume
  select volume c
  attrib disk
  attrib vol
  detail part
  active
  exit
  • Run these:
C:
bootrec /fixmbr
bootrec /fixboot
bootrec /rebuildbcd
  • Reboot
  • If that doesn't work, also try a few of these mysterious incantations:
bootsect /nt60 C:
bootsect /nt60 C: /mbr
bcdboot c:\windows
x:\sources\recovery\startrep

Recovery Partition

Creating the secret partition appears easy, although I haven't tested this. As far as testing, it would also be helpful to know whether it must be the first partition. Size it to 500 MB; mark it active; label it "System Reserved"; copy to it; remove its drive letter; run the bootrec commands above. For sure, it will need boot and bootmgr. On typical Windows 10 installations, it also has bootnxt (which contains only one null byte), bootsect.bak (which is 8192 bytes), and a rather large directory named Recovery. Naturally, you'll need to know how to handle "hidden" files.

See Also

[1] How to fix Windows 2008 R2 BOOTMGR is missing [2] https://support.microsoft.com/en-us/help/927392/use-bootrec.exe-in-the-windows-re-to-troubleshoot-startup-issues