2 minute read

For the second time, my Windows EFI partition got somewhat corrupted and instead of booting Windows, it would always boot into the Recovery Options. There is an option to fix boot there, but it does not help at all (never seen that option fix anything).

Maybe this happens more frequently to me because I am always swapping disks and installing new systems in my Desktop. Last time this happened I had just installed Windows, so I just reinstalled it, but this time I really wanted to fix it. My guess is that some system entries of the old EFI config are not available anymore.

Most solutions I found did not work. Either because the new version of Windows removed some commands, or because one or more commands in the instructions did not execute properly.

In the end, what worked for me was to regenrate the BCD file into the C:\EFI\ and then manually copying the BCD file into the actual EFI partition. This is non-trivial, but I really could not regenerate the BCD directly into the EFI partition. I would just get an error while running the bootrec command from the EFI partition.

HowTo

I booted from an usb-stick with the Windows Installer, this may or may not work from the recovery partition as well (can’t test myself).

Either way, we need to get a Command Prompt. It will be in the advanced options of the installer.

We will need to mount the Windows EFI partition to a drive letter, so the first thing is to make sure the letter is not already used (I have many disks plugged, with many partitions, which makes many letters get used).

I will use J as our target letter. Easiest way to test is to just try to list it

dir j:

It should give an error if the letter J is NOT free. If it lists files and folders, you need to use another letter.

Also, make sure the letter C has your installed Windows disk

dir c:\Users

Check if your user is listed

If your user folder is not there, chances are that your current C: drive is the installer (pendrive). In that case, your Windows partition was probably mounted into another drive letter.

From this point onwards I will assume:

  • J: is the installed Windows EFI partition
  • C: is the installed Windows system partition

Mount EFI partition

We will use diskpart for this

diskpart

Find disk

list disks

Check carefully to find your Windows disk number

Supposing it is disk 2

sel disk 2

Find partition

list vol

The EFI partition is usually 99MB and it will always be FAT32

Select volume and assign letter

sel vol <volume number>
assign letter=j:

Quit diskpart

exit

Create EFI folder on C:

We will first create the EFI folder into the C: partition using bcdboot. Your C: should not have this folder already, since this usually only exists in the EFI partition.

bcdboot c:\windows /s c: /f UEFI

If you have problems, try changing UEFI to EFI

Backup old BCD

Just in case

copy j:\EFI\Microsoft\Boot\BCD C:\OLD-BCD-BACKUP

Replace BCD in EFI partition

Now we replace the BCD file with the one we created in C:

copy c:\EFI\Microsoft\Boot\BCD j:\EFI\Microsoft\Boot\BCD

Confirm overwriting if needed


This should be it.
Rebooting should make it work now.

Comments