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.
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.
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.
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 normally. Fixed!
If You Havin’ Boot Problems…
Try the following steps:
- From your Recovery Environment, or a Windows disc, use the built-in Automatic/Startup Repair.
- Use the command line in the same recovery environment to
Bootrec.exe /FixMbr
andBootrec.exe /FixBoot
. - Use a tool like Gparted to set the desired partition active.
- Reinstall the boot sector to the target drive with
bootsect.exe /nt60 C:
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.
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
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.
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..
Yup, oddly enough, I tried this several times and it didn’t work. So I kept doing chkdsk /r c: and d:.
I guess it finally repaired something, and when I switched d: to the active partition bootrec finally saw the installation. It’s kinda confusing, but for some reason the system reserved takes the c: name, and the installation takes the d: name. Once I figured that part out and the chkdsk looked at the correct disk, I was in business. I wanted to clarify that as thats what hung me up for a while.
Thanks Peter, you’re a life saver. I also had to run “bootrec /rebuildbcd” to add my Windows disk to the boot loader.
Good day, I have an issue with bootrec /fixboot. After typing it I got ” no element found “. How can I fix it ?
I would appreciate for any HELP !
Thanks
Thanks for this! Still saving the day in 2018.