(HOWTO) Restoring Windows EFI Bootloader 7/8/8.1/ (10.x ?) (Recovery from bad INST)

DISCLAIMER = YES I am aware that there are probably guides on this around the Internet. However I am writing this from my own knowledge. So please no posts like.. oh you got it from here or there THANK YOU Kindly... :)

So I am pretty sure this works on 7/8/8.. Confirmed not working 10.x.. Different efi structure

@Kai -- Kai you may find this helpful when you screw a dual boot up :D
@MisteryAngel -- You may find this helpful when you finally go ahead and install to your HDD sometime

WORKING ASSURANCE: How do I know this works... Well go ahead and ask me. I have screwed up windows partitions more than a few bakers dozens of times.. haha... This is how I restore in a pinch provided your original windows partition is okay. SO without further adue lets get started

WINDOWS USERS BE NOT AFRAID TO TRY LINUX NOW

So you ruined your windows bootloader attempting linux eh...? Well lets get that back without reinstalling everything.. HAHA

Alright here we go. Follow these steps as I say. Some steps will require your Unique input and Ill let you know when those are

  1. Boot in EFI mode into your windows install disk
  2. Run the following commands which may or may not be different for you .. YOU MAY ALSO USE YOUR FAVORITE PARTITION MANAGER for this task (deleting the two small bootloader partitions)


diskpart
list disk
select disk 0 (your windows disk)
select partition 1 (this should be the 100 mb part)
delete partition override
select partition 2 (this should be the 128 mb part)
delete partition override
exit

  1. Now go ahead and proceed with these commands. This is what we will do to create the 2 lost/screwed up boot partitions (PLEASE DONT TYPE IN WHAT I WROTE IN PARANTHESIS.. That was for your reference)


diskpart
list disk
select disk 0 #Select the desired disk
create partition efi size=100
list partition
select partition 1 (or whatever the newly created partition's number is)
format quick fs=fat32 label="System"
assign letter=A (Try B if A doesnt work ;) )
create partition msr size=128
list partition (Make sure both partitions are created without errors
list vol
select vol 3 (Use the number corresponding to your windows installation)
assign letter=C
exit

5. Lets move those EFI files over now so we can begin to restore our boot loader

mkdir A:\EFI\Microsoft\Boot
xcopy /s C:\Windows\Boot\EFI*.* A:\EFI\Microsoft\Boot

6. Now its time to use our handy dandy friend. BCD EDIT

a:
cd EFI\Microsoft\Boot
bcdedit /createstore BCD
bcdedit /store BCD /create {bootmgr} /d “Windows Boot Manager”
bcdedit /store BCD /create /d “Windows 7” /application osloader

(THIS WILL RETURN {A Unique String} Refered to as {UNIQUE} Later :D pay attention)

bcdedit /store BCD /set {bootmgr} default {UNIQUE}
bcdedit /store BCD /set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi
bcdedit /store BCD /set {bootmgr} displayorder {default}

(NOW IT IS NO LONGER BOOT MANAGER change bootmgr to default :D )

bcdedit /store BCD /set {default} device partition=c:
bcdedit /store BCD /set {default} osdevice partition=c:
bcdedit /store BCD /set {default} path \Windows\System32\winload.efi
bcdedit /store BCD /set {default} systemroot \Windows
exit

Restart... If you find you have 2 bootable flagged drives (WONT BOOT).. then go into Gparted and removed the Boot flag from partition 2 (the msr reserved partition) (128mb large)

If it still wont boot.. maybe grub isnt updated if that is where your pointing to the windows bootloader from so try configuring the boot priority the UEFI/EFI/BIOS so that the boot partition is at the highest priority for testing purposes :D.

If you receive the error output of

“Reboot and select proper boot device or insert boot media in selected”

Then go ahead and do this... sounds strange but it has led to success for me in the past :D

Shut your PC off.. Unplug all sata power connectors to your HDD... Boot up.. wait for that screen to show that there isnt a device.. shut your computer off... Plug HDD's back in try again

IF IT STILL DOESNT WORK
Reset CMOS via Clear CMOS jumper.. Then this should work. If it doesnt repeat the restore process and try again

Happy Bootloader Restoring... This is @R00tz31820 Signing off
:D

1 Like

Great tutorial :)

Very Nice!
Best Tutorial I have seen on this subject

1 Like

@MisteryAngel
@WastelandSamurai
Thank You.. I am thinking about posting a rescue grub tutorial as well :D

I just created an account just so I could debunk the idea that this method doesn't work for Windows 10. It actually does work but there are some additional tweaks necessary to make it happen. I wanted to touch base on the OP's thread to update it with my findings when applying the methods of his tutorial in Windows 10. A brief background regarding my situation: I had a few GPT Windows OS installations backed up (Win 7 & Win 10) as partitions on a HDD from my Skylake build. Long story short, I fried 3 different drives connected to the system so I needed to revive the Win 10 partition on a new SSD. Props to the OP for his instructions; it gave me a starting point and I was able to follow step-by-step with no issues. However, I was having the following issue: "The drive where Windows is installed is locked". You must set the correct partition and run bootrec in order to replace (restore) the (EFI) boot loader of Windows 10. Picking up where the OP left off, performing the following instructions will allow you to bring the Windows installation back to life:

Boot from the install media and go to Command Prompt

When Command Prompt appears, type this command:
diskpart

sel disk 0

list vol (identify system volume labeled FAT32 at the Fs column)

sel vol 2 (Replace 2 with the volume’s number)

assign letter=A (letter must be unique, it can’t be c:)

exit

cd /d a:\EFI\Microsoft\Boot

bootrec /fixboot

ren BCD BCD.Backup (This will create a backup of your current BCD file.)

bcdboot c:\Windows /l en-us /s a: /f ALL

Remove the install media from the disc tray or USB port

exit

Restart the computer

My source: Fix #5