Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows 10 / How to Restore Deleted EFI System Partition in Windows?

November 30, 2022 Windows 10Windows 11Windows 7Windows Server 2019

How to Restore Deleted EFI System Partition in Windows?

This article will show you how to manually restore an accidentally deleted Windows EFI boot partition on a UEFI computer. This easy way to manually re-create bootable EFI and MSR Windows partitions will allow you to boot the operating system after accidentally formatting or deleting an EFI partition. This guide is relevant to all Windows versions (including Windows 10 and 11, and Windows Server 2022/2019/2016).

Suppose that the EFI boot partition on your UEFI (non-BIOS) computer was accidentally deleted or formatted (for example, when you tried to remove an OEM recovery partition). As a result, your Windows 11/10/8.1/7 doesn’t boot correctly and cycle prompting you to select the boot device (Reboot and select proper boot device or insert boot media in selected boot device and press a key). Next, we will show how to restore Windows boot after deleting the EFI System disk partition (with a Boot Manager and BCD configuration) without reinstalling the OS.

Warning. This guide assumes working with disk partitions and is not intended for beginners. If you interpret the commands wrongly, you can accidentally delete all data on your hard disk. It is also highly recommended to backup important data to a separate media.  

Contents:
  • UEFI/GPT-based Hard Disk Partitions in Windows
  • Missing EFI Partition in Windows
  • How to Create EFI System and MSR Partitions on GPT Drive?
  • Repair the EFI bootloader and Windows BCD on a GPT Drive

UEFI/GPT-based Hard Disk Partitions in Windows

Consider how the default partition table of a boot hard drive with GUID partition table (GPT) on the UEFI computer should look like. You should have at least the following partitions:

  • EFI System Partition (ESP – Extensible Firmware Interface) — 100 MB (partition type — EFI);
  • Microsoft Reserved partition — 16 MB (partition type — MSR);
  • Primary Windows partition (the partition containing Windows).

Default efi partitoions

This is the minimum configuration. These partitions are created by Windows Installer during a clean install of the OS to an unformatted drive.

Computer manufacturers or users can create additional partitions containing, for example, Windows Recovery Environment (Windows RE) in the winre.wim file, a partition with the system image backup provided by the OEM (allows to roll back to the original state of the computer), user partitions, etc.

The EFI partition with the FAT32 file system is a mandatory partition on GPT disks on UEFI computers and has the GUIDc12a7328-f81f-11d2-ba4b-00a0c93ec93b. The default size of the EFI partition is 100 MB (on advanced format disks with 4KB sectors the size of the EFI partition is 260MB).

The MSR partition (Microsoft System Reserved) on the GPT disk is used to simplify partition management and is used for service operations (for example, when converting a disk from basic to dynamic). This is a partition with the GUID label e3c9e316-0b5c-4db8-817d-f92df00215aewith no drive letter assigned. This partition can’t store user data. In Windows 10 and 11, the size of the MSR partition is only 16 MB (in Windows 8.1 the MSR size is 128 MB), and the file system is NTFS. The MSR partition must be between the EFI System partition (ESP) and the primary Windows operating system partition.

The main partition with the NTFS file system contains the installed Windows, programs, and user data. There may also be additional data partitions on the disk.

Missing EFI Partition in Windows

The EFI partition (similar to the System Reserved partition on drives with the MBR partition table) stores the boot configuration store (BCD) and a number of files needed to boot Windows. When the computer boots, the UEFI environment loads the bootloader file (EFI\Microsoft\Boot\bootmgfw.efi) from the EFI System (ESP) partition and transfers control to it. The bootmgfw.efi executable launches the Windows Boot Manager, which loads configuration data from the BCD. Once the BCD is loaded, Windows starts booting via winload.efi.

uefi windows boot manager: set bootmgfw.efi path

When a UEFI computer boots, it looks for the EFI system partition on all attached drives. If the EFI partition is deleted or corrupted, you won’t be able to boot Windows from that drive. A UEFI error will appear could not locate \efi\boot\bootx64.efi – not foundor an empty UEFI Shell prompting you to select a boot device.

Also, you won’t be able to boot Windows if the EFI partition is formatted with the NTFS file system. Even then performing a clean Windows installation, you will receive an error:

Windows detected that the EFI system partition was formatted as NTFS. Format the EFI system partition as FAT32, and restart the installation.

How to Create EFI System and MSR Partitions on GPT Drive?

Because Windows doesn’t correctly, we’ll need a Windows 10/11 installation drive (see how to create a UEFI Bootable USB drive with Windows install files) or any other boot/rescue media. Boot from the installation media and press the Shift+F10 key combination on the first installation screen. A command prompt window should open.

Run the disk and partition management tool:
Diskpart
List the hard disks connected to the computer:

list disk

In our example, there is only one disk 0 connected. The asterisk (*) in the GPT column indicates that a GUID partition table has been created on the disk.

diskpart check gpt partition table

If there is no *in the GPT column, then the disk partition table is MBR. You need to make sure that you previously booted your computer in the native UEFI mode (otherwise, following this instruction is pointless). If you are sure that the partition table type has changed, it may be worth converting the drive from MBR to GPT.

Select this disk:
Select disk 0
Display the list of partitions on the disk:
List partition
In my example, only three partitions are left on the drive:

  • MSR partition — 16 MB
  • Windows system partition — 30 GB
  • Recovery partition – 541 MB

As you can see, the EFI partition (may be called System) is missing (has been deleted).

missing efi system partition on windows disk

Tip. If only EFI boot files were damaged on the EFI partition and the partition itself was not deleted, you can skip the step of recreating partitions using diskpart. In most cases, it is enough to proceed with repairing the EFI bootloader in Windows. If you are using an MBR disk on a computer with BIOS firmware, you can recreate the BCD as described in this article.

Our task is to remove the remaining MSR partition so that we have at least 116 MB of unallocated space on the disk (for MSR and EFI partitions). You can remove this partition using the graphical Gparted tool or directly from the command prompt (that’s exactly what we’ll do).

Important! Please, be extremely careful here and do not accidentally delete Windows partition or partitions containing user data (if there are any).

Select the partition to remove:
Select partition 1
And delete it:
Delete partition override
Make sure that there is only 30 GB primary Windows partition and the recovery partition left (in our case):
List partition
remove msr and efi partitions with diskpart

You can now manually create the EFI and MSR partitions to place the Windows bootloader files. To do it, run these commands in the diskpart context one by one.

Select the disk:
select disk 0
Create a 100 MB EFI partition:
create partition efi size=100
Make sure that the 100 MB partition is selected in diskpart (an asterisk before Partition 1). Format your EFI partition with FAT32 file system, and assign a drive letter to it:
list partition
select partition 1
format quick fs=fat32 label="System"
assign letter=G

Now you need to create a 16MB MSR partition (for Windows 10 or 11).
create partition msr size=16
list partition
list vol

In my case, the drive letter C: is already assigned to the main Windows partition. If it’s not, assign the drive letter to it as follows:
select vol 1
assign letter=C
exit

diskpart: create efi partition

Close the diskpart:

exit

An error may appear when creating an EFI or MSR partition using diskpart:

No usable free extent could be found. It may be that there is insufficient free space to create a partition at the specified size and offset. Specify different size and offset values or don't specify either to create the maximum sized partition. It may be that the disk is partitioned using the MBR disk partitioning format and the disk contains either 4 primary partitions, (no more partitions may be created), or 3 primary partitions and one extended partition, (only logical drives may be created).

diskpart:No usable free extent could be found

This means that there is not enough unallocated (free) space on the disk for the new partition. In this case, you need to reduce the size of the main Windows partition (in our example, this is volume 1) by 128 MB:

select volume 1
shrink desired=128 minimum=128

shrink partition with diskpart

Then create the EFI and MSR partitions as described above.

Repair the EFI bootloader and Windows BCD on a GPT Drive

After you have created a minimal disk partition structure for the GPT drive on the UEFI computer, you can proceed to copy the EFI boot files to the new partition and create a bootloader configuration file (BCD).

Now use the bcdboot.exe tool to copy the UEFI boot environment files from the Windows system directory to the EFI boot partition and recreate the BCD bootloader configuration. Run the command:

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

Boot files successfully created.

bcdboot: restore uefi bootloader on windows 10 and 11

As a result, a predefined directory structure will be created on the EFI partition. The following files must be present on the EFI system volume:

  • \EFI\Microsoft\Boot\bootmgfw.efi
  • \EFI\Microsoft\Boot\bootmgr.efi
  • \EFI\Microsoft\Boot\memtest.efi
  • \EFI\Microsoft\Boot\BCD
  • \EFI\Microsoft\Boot\Fonts\wgl4_boot.ttf
  • \EFI\Boot\bootx64.efi

List the current Windows Boot Manager bootloader configuration. An entry should appear in the {bootmgr} section pointing to the partition containing the UEFI boot control file (\EFI\MICROSOFT\BOOT\bootmgfw.efi). In this example, it is partition=G , or partition=\Device\HarddiskVolume2 (if you haven’t assigned a drive letter for the EFI partition).

The UEFI bootloader must then pass the control to the Windows Boot Loader file \Windows\system32\winload.efi on partition=C:

bcdbedit: show windows boot manager configuration, check bootmgfw.efi path

Reboot your computer (use the wpeutil reboot command in order to reboot from the WinPE environment) and remove the bootable USB flash drive.

Optional! You can manually perform all the actions that the bcdboot command does. Next, we’ll show you how to copy the EFI system files and rebuild the BCD yourself with the bcdedit command.

Copy the EFI environment boot files from the directory of your drive where your Windows is installed:

mkdir G:\EFI\Microsoft\Boot

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

copy efi files

Rebuild the Boot Configuration Data (BCD) entry in Window Boot Manager:
g:
cd EFI\Microsoft\Boot
bcdedit /createstore BCD
bcdedit /store BCD /create {bootmgr} /d “Windows Boot Manager”
bcdedit /store BCD /create /d “My Windows 10” /application osloader

The command returns the GUID of the created BCD entry. Use this GUID instead of {your_guid} in the following command:

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

bcdbedit: create boot entry for efi system partition

The following bcdedit commands are run in the {default} context:
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


If Windows didn’t boot correctly the first time, try the following:

  1. Power off your device;
  2. Unplug (physically) your hard drive;
  3. Turn your computer on, wait till the boot error window appears (An Operating System not found), and turn it off again;
  4. Plug your drive back.

If this doesn’t help, boot from the installation USB flash drive and run the command:

bootrec /rebuildbcd

Restart your computer

bootrec rebuildbcd

Then in our case (tested on a VMWare virtual machine with UEFI firmware), we had to add a new item to the boot menu by selecting the EFI\Microsoft\Boot\bootmgrfw.efi file on the EFI partition.

In some UEFI menus, by analogy, you need to change the priority of boot partitions.

efi boot option FI\Microsoft\Boot\bootmgrfw.efi

After all these actions, your Windows should boot correctly.

Tip. If something doesn’t work, it is recommended to make sure that only EFI partition has the boot flag. You can do it using GParted LiveCD.

 In some cases, after recreating the EFI and MSR partitions and restoring the BCD bootloader, Windows may stop shutting down gracefully. If you experience this problem, you can fix it by disabling the Fast Startup feature in Windows:

  1. Open the Power Options in the Control Panel powercfg.cpl;
  2. Select Choose what the power button does;
  3. Click the Change settings that are currently unavailable button and disable the “Turn on fast startup” option in the “Shutdown settings” section.disable fast startup on windows 10/11

194 comments
71
Facebook Twitter Google + Pinterest
previous post
Using Process Tracking Audit Policy in Windows
next post
How to Automatically Disable Wi-Fi When Ethernet is Connected?

Related Reading

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

Enable Single Sign-On (SSO) Authentication on RDS Windows...

May 23, 2023

Allow Non-admin Users RDP Access to Windows Server

May 22, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Allow Multiple RDP Sessions in Windows 10 and 11?
  • How to Repair EFI/GPT Bootloader on Windows 10 or 11?
  • Network Computers are not Showing Up in Windows 10/11
  • How to Run Program without Admin Privileges and Bypass UAC Prompt?
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows
  • How to Create a Wi-Fi Hotspot on your Windows PC?
  • Updating List of Trusted Root Certificates in Windows
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top