Skip to content

Restoring a Windows 8 Bootloader

Screenshot of the Hyper-V Manager on Windows 8

Microsoft’s Hyper-V is a really cool virtualisation technology I have been having fun exploring. You cannot run a Hyper-V Server on a Windows 7 host, however, so in order to run it, I installed Windows 7 and Windows Server 2008 R2 side-by-side, and used it in the latter.

All that has changed in the era of Windows 8, however, and you can run a Hyper-V Server on the client version of Windows 8, if it is Windows 8 Pro. Hooray!

So, to cut a long story short, post-upgrade, I felt I didn’t really need my separate Windows Server 2008 R2 partition for Hyper-V, so I deleted it and expanded the Windows 8 partition to fill the space. Only to find that Windows now wouldn’t boot. Oops.

I originally installed Windows 7 first, followed by Windows Server 2008 R2, following best practice to install newer operating systems after earlier ones. What had happened now, though, was that I had just wiped out the bootloader that was sitting happily on the Windows Server 2008 R2 partition.

Fixing the Bootloader: First Steps

Startup Repair

The first port of call when you have a broken Windows bootloader is Microsoft’s own Startup Repair tool on the Windows disc, or in your Recovery Environment.

Windows 8 Automatic Startup Repair

This tool is generally completely useless in situations where Windows will not boot because the hard drive has failed, but in this situation, where we genuinely have a missing boot loader, it is often the only thing you need to do to get everything running again.

Unfortunately, it didn’t work in my case. More investigation, or perhaps more advanced tools, were needed.

Bootrec.exe

Choosing to enter the Command Prompt instead of the Automatic Repair option grants you more power — if you know how to use the command line tools for dealing with broken bootloaders.

Windows 8 Command Prompt Startup Repair

In my scenario, it was possible that the bootloader on the Master Boot Record of the disk was missing after the change in partition layout, so this was the first command I used.

BootRec.exe /FixMbr

This operation completed without issue, but it didn’t solve my issue — Windows still would not get to a bootloader. Since my Windows Server 2008 R2 partition likely had the BOOTMGR code on it, perhaps it wasn’t the MBR that needed to be fixed.

BootRec.exe /FixBoot

Upon running this command, I saw an Element not found error, suggesting that there were no Windows installs at all! This obviously was not correct, however — the partition could be mounted and everything was still there.

Bootsect.exe and Setting the Active Partition

As it turned out, in my case, not only did the boot code require reinstallation, but I had to set the ‘active’ flag on the new C: drive, or it won’t get invoked at all! This is in contrast to what I’m more familiar with, where the GRUB bootloader will kick a Linux system into action regardless of whether any partitions are ‘active’.

So, first, I used Gparted to make the partition active.

Screenshot of Gparted to edit partition flags

Now, a reboot into the Windows 8 CD and back to the command prompt, and the following command reinstalled the boot sector on this new C: drive.

bootsect.exe /nt60 C:

After another run through BootRec.exe’s options just for luck…

BootRec.exe /FixMbr
BootRec.exe /FixBoot

There was no longer an error about Element not found, and these commands were able to complete.

Finally, I rebooted to this:

Windows 8 booting successfully

Windows 8, booting normally. Fixed!

If You Havin’ Boot Problems…

Try the following steps:

  1. From your Recovery Environment, or a Windows disc, use the built-in Automatic/Startup Repair.
  2. Use the command line in the same recovery environment to Bootrec.exe /FixMbr and Bootrec.exe /FixBoot.
  3. Use a tool like Gparted to set the desired partition active.
  4. Reinstall the boot sector to the target drive with bootsect.exe /nt60 C:

Like this post?

4 Comments

  1. Sergey wrote:

    Gparted? Why? There is standart windows utility, called “diskpart”. Example of use:
    > diskpart
    > list disk
    > select disk #
    > list partition
    > select partition #
    > active
    That’s all. Plain and simple.

    Friday, July 5, 2013 at 22:07 | Permalink | Using Mozilla Firefox Mozilla Firefox 7.0.1 on Linux Linux
  2. Ashray wrote:

    Awesome…Got my windows 8 back running on my laptop.I Had lost windows 8 entry from the boot menu,my boot files were corrupted. I had referred various sites,none of them worked.Finally this worked like a charm..Thank you so much

    Sunday, November 3, 2013 at 11:02 | Permalink | Using Google Chrome Google Chrome 30.0.1599.101 on Windows Windows 7
  3. Bob Daniel wrote:

    Very late I know. Note that this procedure will likely mess about with GRUB. I had to repair GRUB to get it to dual boot again.

    Wednesday, June 4, 2014 at 14:22 | Permalink | Using Mozilla Firefox Mozilla Firefox 29.0 on Ubuntu Linux Ubuntu Linux
  4. Dan wrote:

    Makes me want to go back to Win 7. My drive was really messed up. ie. locked… followed above and worked… drive is 1 and partition is 0, for most people. took me 2 tries to figure that out.. Thanks guys and Sergey for the commands. Don’t know what Gparted is..

    Thursday, June 19, 2014 at 01:49 | Permalink | Using Mozilla Firefox Mozilla Firefox 30.0 on Windows Windows XP

Post a Comment

On some sites, you must be logged in to post a comment. This is not the case on this site.
Your email address is not made public or shared. Required fields are marked with *.
*
*
*

Posting a comment signifies you accept the privacy policy.
Please note — usually your comment will appear straight away but sometimes it will be held for approval (this is due to the spam filter). If your comment is waiting to be approved, please don’t post it again! It will appear eventually.