Skip to main content
Windows 10

How to Repair EFI/GPT Bootloader on Windows 10

By April 14, 2021September 10th, 2021No Comments

In this post we will learn how to repair Windows bootloader on a modern computer that uses UEFI instead of BIOS and GPT disk partition table (instead of MBR). The corruption of the Windows bootloader can occur after installing a second OS (in Dual Boot configurations), incorrect actions during Windows recovery, removal of some data on hidden partitions, malicious software (virus, ransomware, etc.) and for some other reasons. This post provides a step-by-step guide for recovering a damaged or deleted bootloader on Windows 10 and Windows 8.1 on computers running in native (non-legacy) UEFI mode. The guide should help if Windows doesn’t boot due to missing or damaged boot configuration file \EFI\Microsoft\Boot\BCD.

The boot configuration data for your PC is missing: EFI\Microsoft\Boot\BCD

A computer with Windows 10 installed in native UEFI mode will fail to boot if the EFI bootloader is corrupted. When trying to boot the computer, the following BSOD (Blue Screen of Death) error appears:

The boot configuration data for your PC is missing or contains errors.
File :\EFI\Microsoft\Boot\BCD
Error code: 0xc000000f

or:

Error code: 0xc000014c
boot configuration errors 0xc000000f or missing file \EFI\Microsoft\Boot\BCD

This error indicates that the Windows bootloader configuration – Boot Configuration Data (BCD) has been corrupted or even completely removed. If you try to repair the bootloader on a UEFI computer using the bcdedit tool, you will receive an error like this:

The boot configuration data store could not be found.
The requested system device cannot be found.

The fact is that if Windows 10 is installed in native UEFI mode on a GPT disk, then the Windows 10 EFI bootloader (Windows Boot Manager) stores the boot manager and BCD configuration on a separate hidden EFI volume (100 MB in size with the FAT32 file system). The bcdedit tool doesn’t see this EFI partition, and cannot manage the bootloader configuration on it. If the computer boots with a black screen with the message “Operating System not found”, most likely the Windows bootloader is completely removed. Follow the instructions on the link.

Automatic Windows Bootloader Recovery

The procedure for the automatic repair of the bootloader used in the Windows Recovery Environment (WinRE), is usually useless in such cases. But it’s worth a try anyway:

  1. Try to boot your device from the recovery disc or installation Windows 10 media;
  2. On the installation screen, click the Restore System;
  3. Then select Troubleshoot -> Startup Repair and select the OS whose bootloader you want to try to recover;
  4. But most likely the result will be negative: Automatic Repair couldn’t repair your PC

Using BCDBoot to Manually Repair EFI Bootloader in Windows 10

Let’s move on to the procedure for manually restoring the EFI Windows bootloader on a computer with UEFI.

To repair the bootloader configuration (BCD), you have to boot from the original installation Windows 10 media (or a recovery disk or a special UEFI bootable USB flash drive). After booting into the recovery environment, you need to open a command line: select System Restore – > Troubleshoot-> Command Prompt). You can run Command Prompt if you only have a Windows installation media at hand. To do this, on the first screen of Windows installation (when choosing a language and keyboard layout), press the key combination Shift+F10 (or Shift+Fn+F10 on some laptop models).

system restore mode win 8

In the command prompt that opens, run the disk management tool by typing the command:
diskpart
Display the list of drives on the computer:
list disk
At this stage, it is very important to determine the type of partition table on the disk on which Windows is installed: MBR or GPT. The point is that the EFI bootloader is used only on disks with a GPT partition table.

If the disk has an asterisk (*) in the Gpt column, then the GPT partition table is used, if not, the MBR is used.

diskpart: GPT or MBR - checking disk partition table

If your disk uses a GPT partition table, follow the steps below in the instructions to repair the Windows EFI bootloader.

If you have an MBR partition table on your disk, these instruction won’t work for your computer. Most likely you have a computer with BIOS or Legacy/Compatibility Support Mode (CSM) option enabled in the UEFI settings.

On MBR disks, the Windows bootloader is stored on a separate System Reserved partition, not on an EFI partition (in any case, don’t convert the MBR partition table to GPT until you fix the Windows bootloader). Use another guide to restore the BCD bootloader on MBR (Master Boot Record) disk.

Select the disk with Windows installed (if there is one hard disk in the system, its index should be 0):
sel disk 0
Display the list of partitions and volumes on the disk:
list partition
list volume

diskpart : list volume . efi volume

In this example, you can see that the EFI boot partition (it can be easily identified by the size of 100 MB, and the FAT32 file system, most often its label is System EFI) has the partition 2 index (aka Volume 5 with the Hidden label). The main partition with the installed Windows with the NTFS file system (it can be both Windows 10 and Windows 8.1) is volume 2. There must also be an MSR (Microsoft System Reserved) partition of 16 MB for Windows 10 (or 128 MB for Windows 8.1). If you don’t have a separate EFI or MSR partition, you can recreate them manually.

Assign the drive letter K: to the hidden EFI volume:
select volume 1
assign letter K:
A message that the drive letter has been successfully to the EFI partition should appear:

DiskPart is successfully assigned the drive letter or mount point.

Close the diskpart:
exit
Go to the bootloader directory on the hidden volume:
cd /d K:\efi\microsoft\boot\
In this case, K: is the drive letter assigned to the EFI partition just above. If the \EFI\Microsoft\Boot\ directory is missing (error The system cannot find the path specified), try the following commands:

cd /d K:\Boot\
or
cd /d K:\ESD\Windows\EFI\Microsoft\Boot\At this point, many guides recommend running the following commands, which should overwrite the partition boot record, find the installed Windows and add them to the BCD:

bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd

or even:
bootrec /FixMbr (recovering MBR record for a GPT disk looks strange)

All of these commands are applicable only for disks with MBR. If your computer boots in UEFI mode, then it necessarily uses the GPT partition table (as in our case). Therefore, when you run bootrec commands, you will see an error: access is denied

To fix boot records on an EFI partition, you need to use the BCDBoot tool. The BCDBoot tools allows you to restore bootloader files on the system partition by copying them from the system directory on the Windows partition. The BCD bootloader configuration is recreated using the %WINDIR%\System32\Config\BCD-Template file.

Use the attrib command to remove the hidden, read-only, and system attributes from the BCD file:

attrib BCD -s -h -r

Delete the current BCD configuration file by renaming it (this will keep the old boot configuration as a backup):
ren BCD BCD.bak
Using the bcdboot.exe utility, you need to recreate the BCD store by copying the UEFI boot environment files to the boot partition from the Windows directory:
bcdboot C:\Windows /l en-us /s k: /f ALL

  • C:\Windows – is the path to the directory with Windows 10 installed;
  • /f ALL – means that you want to copy the Windows Boot Environment files, including those for UEFI and BIOS computers (potential ability to boot in UEFI and BIOS systems). To copy only the EFI bootloader, use the /f UEFI command;
  • /l en-us — is a type of the system locale. By default, en-us – English (USA) is used;
  • /c – this is a new BCDBoot option in Windows 10 that allows you to overwrite existing boot records (including debugsettings). Use this option to ignore old boot settings and create a clean BCD configuration;
  • /v – used to enable BCDBoot verbose output.

If you use a localized version of Windows 10, the command will be different. For example, in the Windows version for the UK, use the following command
bcdboot c:\Windows /l en-uk /s K: /f ALL
Windows 10 Dutch:
bcdboot c:\Windows /l nl-NL /s K: /f ALL
Windows 10 Deutch (German):
bcdboot c:\Windows /l de-DE /s K: /f ALL

Now, if you run the bcdedit command, you will see the following :

An entry should appear in the Windows Boot Manager section containing the full path to the UEFI boot file (\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI). In this example, it is located on volume 2 (partition=\Device\HarddiskVolume2).

bcdedit: windows boot manager bootmgfw.efi

Possible errors:

  • BFSVC Error: Could not open the BCD template store. status – [c000000f] – check if the entered command is correct and whether you have a localized Windows version installed. In this case you need specify the correct local language code. The bcdboot tool copies the BCD template files from the \Windows\System32\Config directory. If the BCD templates in this folder are damaged or deleted, try to check the integrity of the system files offline using the sfc.exe tool (you need a Windows installation disc – drive D :): sfc /scanow /OFFBOOTDIR=C:\ /OFFWINDIR=D:\WINDOWS
  • BFSVC Error: Error copying boot files from Last Error = 0x570 – try to check drive with the help of command: CHKDSK K: /F
  • BFSVC Error: Failed to set element application device. Status = [c000000bb] – check the EFI and Windows 10 partitions with chkdsk.exe. Verify that the hidden and system attribute of the BCD file is cleared. Remove it:
    attrib -s -h \EFI\Microsoft\Boot\BCD
    del \EFI\Microsoft\Boot\BCD

  • Failure when initializing library system volume – make sure you are using the correct FAT32 partition with EFI (you may have several similar partitions).

Now you need to restart your computer and disconnect the bootable media. Then the Windows Boot Manager appears in the list of bootable devices, where you can choose desired operating system to boot. Your EFI bootloader and BCD configuration have been restored successfully!

Leave a Reply