Repairing boot information after a recovered UEFI system fails to boot

Symptoms

After system recovery from the System Recovery Environment (SRE) for UEFI based systems, the system is rebooted. Upon reboot, the system attempts to boot in the order of boot devices but does not boot into Windows as expected.

Booting into the UEFI based SRE again, and running the diskpart utility from a command prompt, you may find the SRE recovery process did not create a 100 MB system partition for the UEFI boot sequence to use. For example, you may run the diskpart commands below with similar output.

diskpart

list disk may return disk 0 (the system volume) and disk 1 (the SRE on a usb thumbdrive)
Sel disk 0 to select the recovered disk.

list part lists partitions on disk 0. It may return one partition, part 1 PRIMARY, but no part 2 for the EFI system boot files.
list volume may return C: (the Windows volume), D: (the SRE thumbdrive), and E: (the CD/DVD) but no system hidden EFI volume listed as FAT32.

Resolution

Create a 260 MB system partition, then run a bcdboot command to copy boot files to it. To do so, boot the system back into the UEFI based SRE from a CD or thumbdrive and open a command prompt. Make certain you have created the CD or thumbdrive with the UEFI iso file.

The commands are below in bold:

X:\windows\system32>diskpart

Microsoft DiskPart version 10.0.10240

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: MININT-3A416N9

DISKPART> list disk

Disk  ###  Status  Size       Free  Dyn  Gpt
__________________________________________
Disk  0     Online  489 GB 0        B      *

[You should see an asterisk in the Gpt column, or else the command to create an efi partition may fail.]

DISKPART> sel disk 0

Disk 0 is now the selected disk. [This is the recovered disk.]

DISKPART> list part

Partition ### Type       Size       Offset
————- —————- ——- ——-
Partition 1     Primary  489 GB 1024 KB

DISKPART> sel part 1

Partition 1 is now the selected partition. [This is the partition that contains the Windows volume.]

DISKPART> shrink desired=1024

DiskPart successfully shrunk the volume by: 1024 MB

DISKPART> create partition efi size=260

DiskPart succeeded in creating the specified partition. [This is the 100 MB EFI system partition. We are making it a little larger than that.]

DISKPART> format quick fs=fat32

100 percent completed [The EFI volume must be formatted with the FAT32 file system.]

DiskPart successfully formatted the volume.

DISKPART> exit

Leaving DiskPart…

X:\windows\system32>bcdboot c:\windows
Boot files successfully created.

If the final command bcdboot c:\windows returned the error "Failure attempting to copy boot files", go back into diskpart to prepare for a second bcdboot command.

diskpart
list disk
sel disk 0 (Selects the recovered disk. Usually disk 0 but check your output.)
list part (Lists the partitions on disk 0. Check your output for the partition number of the 260 MB partition created earlier.)
sel part 2 (Selects the 260 MB system partition created earlier.)
list vol (Lists all disk volumes. Check your output for the system hidden EFI volume number.)
sel vol 2 (Selects the 260 MB system hidden EFI volume.)
assign letter=S
list vol (to check that the S drive letter was assigned to the selected volume, and that the drive letter C was assigned to the recovered volume.)
exit

Then, type bcdboot c:\windows /s s: /f ALL

You should see output "Boot files successfully created." You can then reboot the system.

Reference: https://www.diskpart.com/articles/bcdboot-failure-when-attempting-to-copy-boot-files.html

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/bcdboot-command-line-options-techref-di