Posted on August 27, 2015 · Posted in Windows 7

How to Repair Deleted EFI Partition in Windows 7

In this article we’ll show how to manually repair accidentally deleted Windows 7 boot partitions on UEFI systems.

So, suppose one of the system partitions in the EFI system has been accidentally and Windows 7 doesn’t boot constantly offering to select the boot device (Reboot and select proper boot device or insert boot media in selected).

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

Let’s remind what the table containing UEFI disk partitions with the GPT layout looks like. You should have at least the following partitions:

  1. ESP – EFI System Partition — 100 MB (partition type — EFI)
  2. Microsoft Reserved partition — 128 MB (partition type — MSR)
  3. Primary Windows partition (the partition containing Windows)

Default efi partitoions

This is the minimum configuration. Computer manufacturers or users can create their own  partitions containing, for example, Windows Recovery Environment (Windows RE), a partition with the system image backup provided by the manufacturer (allows to roll back to the default state of the system), user partitions, etc.

Since the system doesn’t boot correctly, we’ll need Windows installation disk (or any other boot disk). So, boot from the installation disk and on the first installation screen press Shift+F10. The command prompt window opens.

Shift+F10 - command prompta

Run the disk and partition management utility:


Display the list of hard disks in the system. (In our example, there is only one disk, disk 0. The asterisk in the GPT column means that it uses the GUID partition table).

list disk

Select this disk:

Select disk 0

Display the list of partitions on this disk:

List partition

On our example, only two partitions are left in the system:

MSR partition — 128 MB

Windows system partition — 9 GB

As we can see, there is no EFI partition (it has been deleted).

diskpart list partition

Our task is to delete the remaining MSR partition so that we have at least 228 MB of unpartitioned space on the disk (for MSR and EFI partitions). You can delete this partition using the graphic tool Gparted or directly from the command prompt (we’ll choose the last variant).

Important! Please, be very attentive here not to delete Windows partition or partitions containing user data (if there are any).

Select the partition to be deleted:

Select partition 1

And delete it

Delete partition override

Make sure that there is only Windows partition left:

List partition

delete msr partition

Now we can create EFI and MSR partitions manually. To do it, run these commands in diskpart context one by one:

Select the disk;

select disk 0
create partition efi size=100

Make sure that the partition of 100 MB (with asterisk) is selected:

list partition
select partition 1
format quick fs=fat32 label="System"
assign letter=G
create partition msr size=128
list partition
list vol

In our case, disk letter C: is already assigned to our Windows partition. Otherwise, assign the letter to it as follows:

select vol 1
assign letter=C

recreate efi and msr partitions

Copy the EFI environment files from the directory of the installed Windows 7:

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

copy efi files

Recreate Windows 7 loader configuration:

cd EFI\Microsoft\Boot
bcdedit /createstore BCD
bcdedit /store BCD  /create {bootmgr} /d “Windows Boot Manager”
bcdedit /store BCD /create /d “Windows 7/application osloader

The command returns the GUID of the created record, in the next command put this GUID instead of {your_guid}

create bcd store

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}

bcdedit bootmgr

The following 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

bcdedit winload efi

Tip. EFI loader in Windows 8 is recovered easier and the whole procedure is described in How to Recover EFI Loader in Windows 8.

Restart your computer… In our case it didn’t start from the first time:

  • Turn your PC off
  • Unplug your hard drive
  • Turn your PC on, wait till the boot error window appears and turn it off again
  • Plug your disk

Then in our case (the test took place on the VMWare virtual machine with UEFI system) we had to add another item to the boot menu by selecting EFI\Microsoft\Boot\bootmgrfw.efi on the EFI partition.

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

After all these actions, Windows 7 should boot correctly.

setup is starting services

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

Related Articles