see attached PDF
How to Repair EFI/GPT Bootloader on Windows 10 or 11 In this article, we will learn how to repair the Windows bootloader on a modern computer that uses UEFI instead of a classic 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), file system corruption, incorrect actions during Windows recovery, removal of some data on hidden partitions, malicious software (virus, ransomware, etc.), and for some other reasons. This article contains a step-by-step guide for repairing a damaged or deleted bootloader in Windows 11/10/8.1 and Windows Server 2022/2019/2016/2012R2 on computers running in native (non-compatible) UEFI mode. You can use this guile both to repair the binary files of the Windows bootloader, and the bootloader configuration \EFI\Microsoft\Boot\BCD file (in cases where Windows doesn’t boot due to the missing or corrupted BCD boot configuration file). Contents: Windows Boot Error: Boot Configuration Data is Missing (EFI\Microsoft\Boot\BCD) Automatic Windows Bootloader Repair with WinRE Using BCDBoot to Manually Repair EFI Bootloader in Windows Windows Boot Error: Boot Configuration Data is Missing (EFI\Microsoft\Boot\BCD) A UEFI computer with Windows installed in native mode will not be able to boot if the Windows EFI bootloader is corrupted. When trying to boot from a disk with a damaged or missing EFI bootloader, the following BSOD (Blue Screen of Death) error appear: 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 bcdedit tool, you will receive an error: The boot configuration data store could not be found. The requested system device cannot be found. If Windows 10/11 is installed in native UEFI mode on a GPT disk, then the Windows 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 you only see a black screen with the message “An operating system wasn’t found” when you boot your computer, it’s likely that the Windows bootloader has been completely removed. Follow the instructions on the link. Automatic Windows Bootloader Repair with WinRE The procedure for the automatic repair of the EFI bootloader used in the Windows Recovery Environment (WinRE) is usually useless in such cases. But it’s still worth a try: Boot your device from the recovery disc or Windows 10/11 installation media; Click the Restore System on the installation screen; Then select Troubleshoot -> Startup Repair and select the OS whose bootloader you want to try to repair;windows10 Startup Repair menu But most likely the result will be negative: Automatic Repair couldn’t repair your PC. Automatic Repair Couldn’t Repair Your PC Using BCDBoot to Manually Repair EFI Bootloader in Windows Let’s move on to the procedure for manually repairing the EFI Windows bootloader on a UEFI computer. To repair the bootloader configuration (BCD), you have to boot from the original Windows installation media (also, you can use a recovery disk or a special UEFI bootable USB flash drive). After booting into the recovery environment, you need to open a command-line console: select System Restore – > Troubleshoot-> Command Prompt). You can run the Command Prompt even if you only have a Windows installation media at hand. To do this, it is enough to press the key combination Shift + F10 (or Shift + Fn + F10 on some laptop models) on the first Windows setup screen (when choosing a language and keyboard layout). system restore mode win 8 In the command prompt that opens, run the disk management tool: 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 your 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 asterisk (*) is in the Gpt column, then the GPT partition table is used on disk. 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, this guide 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, and not on the 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 a BIOS computer with MBR (Master Boot Record) disk. Select the drive where your Windows is installed (if there is only one hard drive in the system, its index should be 0): sel disk 0 Display the list of partitions and volumes on this disk: list partition list volume window efi partition table structure In this example, you can see that the EFI boot partition has the partition 2 index (aka Volume 5 with the Hidden label). The easiest way to identify an EFI partition is by the FAT32 file system and 100 MB in size (this is the standard minimum size of EFI partition for Windows computers; in rare cases, the partition size may differ). The most commonly used label for it is System EFI or ESP/EFI System Partition). In our example, the main partition on which Windows is installed has a volume 2 index, is formatted in the NTFS file system, and is assigned the drive letter C:. dir C:\ Make sure that this drive contains the Windows, Program Files, Users, and other directories. identify windows system partition in winpe If these directories are missing, then your Windows drive has a different drive letter. Check the contents of drives with different drive letters assigned. Write down the drive letter assigned to the Windows partition. We will use it as one of the arguments of the bcdboot command a little later. The partition table must also contain an MSR (Microsoft System Reserved) partition of 16 MB in Windows 10/11 (or 128 MB in Windows 8.1). If you don’t have a separate EFI or MSR partition, you can recreate them manually. Check the article Restoring deleted EFI and MSR system partitions. Assign the drive letter K: to the hidden EFI volume: select volume 5 assign letter K: A message that the drive letter has been successfully assigned 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 (preparing MBR record for a GPT disk looks strang) You can use all these commands only for MBR-based disks. If your computer boots in UEFI mode, then it definitely uses the GPT partition table (as in our case). Therefore, when you run bootrec commands, you will see an error: access is denied You need to use the BCDBoot.exe tool to restore bootloader files and fix the boot records on the EFI 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 tool, you need to copy the critical files of the UEFI boot environment from the system directory to the EFI boot partition and recreate the BCD bootloader config file: bcdboot C:\Windows /l en-us /s k: /f ALL C:\Windows – the path to the root Windows system directory on the disk (this is your disk on which your Windows is installed, we determined it earlier using the diskpart command); f ALL –means that you need to copy the Windows Boot Environment files, including those for UEFI and BIOS computers (theoretically able to boot both on UEFI and BIOS computers). To copy only the EFI bootloader, use the /f UEFI command; /l en-us —specifies the system locale that is used when initializing the BCD store. By default, en-us – English (USA) is used; /s K: — copy the bootloader EFI files to the specified partition; /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. Hint. If you use a localized version of Windows 10/11, the command will be different. For example, in the Windows version for the UK, use the following command: bcdboot c:\Windows /l en-GB /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 A complete list of language/region tags for Windows is available here: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/available-language-packs-for-windows?view=windows-11 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 5 (partition=\Device\HarddiskVolume5). bcdedit: windows boot manager bootmgfw.efi Windows Boot Manager -------------------- identifier {bootmgr} device partition=\Device\HarddiskVolume5 path \EFI\Microsoft\Boot\bootmgfw.efi description Windows Boot Manager locale en-US inherit {globalsettings} bootshutdowndisabled Yes default {CURRENT} resumeobject {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} displayorder {default} toolsdisplayorder {memdiag} timeout 30 Windows Boot Loader ------------------- identifier {current} device partition=C: path \Windows\system32\winload.efi description Windows 10 locale en-US inherit {bootloadersettings} recoverysequence {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} recoveryenabled Yes isolatedcontext Yes allowedinmemorysettings 0x15000075 osdevice partition=C: systemroot \Windows resumeobject {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} The Windows Boot Manager section must contain the path to the EFI partition (=\Device\HarddiskVolume5 ) and the path to the boot manager file (bootmgfw.efi). The Windows Boot Loader section contains the Windows partition info and the path to the Windows EFI bootloader ( \Windows\system32\winload.efi). When you turn it on, your computer will pass control to the EFI bootloader, which will start the Windows bootloader. 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 to specify the correct local language code. bcd template file in windowsThe bcdboot tool copies the BCD template files from the \Windows\System32\Config directory. If the BCD template files 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 as a source, drive D: in this case): sfc /scanow /OFFBOOTDIR=C:\ /OFFWINDIR=D:\WINDOWS BFSVC Error: Error copying boot files from Last Error = 0x570 – try to check drive using the command CHKDSK K: /F BFSVC Error: Failed to set element application device. Status = [c000000bb] – check the EFI and Windows 10 partitions using chkdsk.exe. Verify that the hidden and system attribute of the BCD file is cleared: attrib -s -h \EFI\Microsoft\Boot\BCD del \EFI\Microsoft\Boot\BCD bcdboot: bfsvc error Failure when initializing library system volume – make sure you are using the correct FAT32 partition with EFI (you may have several similar partitions); Failure when attempting to copy boot files – check the Windows drive letter in your bcdboot command. The screenshot below shows that the error appeared when trying to copy the boot files from the C: drive. In this case, most likely the Windows drive is assigned a different letter, such as D:. You can find the Windows drive and the assigned drive letter using the diskpart and dir commands (described above).bcdboot error • Failure when attempting to copy boot files Now you need to restart your computer and disconnect the bootable media. If you did everything correctly, the Windows Boot Manager should appear in the list of bootable devices, where you can choose a desired operating system to boot. Your EFI bootloader and BCD configuration have been restored successfully! In some cases, after repairing the BCD bootloader, when Windows boots, a BAD SYSTEM CONFIG INFO error appears. To fix the error: Make sure you haven’t made any recent changes to UEFI settings. Undo all changes. Boot your computer from the installation/bootable flash drive and change the bootloader configuration with the commands: bcdedit /deletevalue {default} numproc bcdedit /deletevalue {default} truncatememory
Last modified
11 months ago
Last modified on 01/05/24 01:34:28
Attachments (1)
- Best Way to Fix MBR2GPT Cannot Find OS Partition.pdf (1.5 MB ) - added by 19 months ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.