How to Restore The Structure of Deleted EFI Partitions in Windows
In this article we will show how to manually restore accidentally deleted Windows 10 boot partitions in an UEFI system.
So, let us suppose that somehow, accidentally or not very accidentally, one of system partitions in an UEFI system was deleted, as a result of which Windows 10 cannot load any longer, being stuck in a cycle of suggesting to choose an insert boot media (Reboot and select proper boot device or insert boot media in selected).
Warning! This manual suggests management of disk partitions and is not meant for beginners. If commands are interpreted incorrectly, you can accidentally delete all data from your hard disk drive. We also strongly recommend backing up all your important data to a separate media.
Now we would like to remind you on how a partition table of a GPT-formatted boot hard disk drive should look like in an UEFI system. At least, there should be the following partitions:
- EFI system partition (ESP – EFI System Partition) – 100 Mb (partition type — EFI);
- Microsoft reserved partition – 128 Mb (partition type — MSR);
- Windows primary partition – the partition containing Windows.
This is exactly what we mean by saying minimal configuration. PC manufacturers or users can additionally create their own partitions which can contain, for example, Windows Recovery Environment (Windows RE), a partition with a reserved manufacturer’s system image (which allows restoring initial state of the computer), user-created partitions etc.
Advice. For installation of Windows 10 to computers with UEFI support you will need an authentic DVD or a specially created bootable flash drive.
As the system does not load correctly, we will need a Windows setup disk (or any other boot disk). So, now we boot from the setup disk and in the screen of beginning installation, press the key combination Shift+F10. There must appear a command prompt window:
Launch the disk and partition management utility:
Diskpart
Let us list the hard disk drives available in the system (in this example, there is one disk, disk 0. The asterisk (*) in Gpt column means that the disk uses the GPT partition table).
list disk
Choose this disk:
Select disk 0
Send the list of partitions to the screen:
List partition
In our example, there are only 2 partitions left in the system:
- MSR partition — 128 Mb;
- Windows system partition – 9 Gb.
As we can see now, EFI is absent (deleted).
Our task is to delete the remaining MSR partition so that there should be at least 228 Mb virgin space left (for MSR and EFI partitions). The remaining partition can be deleted with the help of the graphic application GParted or directly from the command prompt (that is what we will do).
Important! At this moment, be most attentive and make sure you do not delete, by accident, the partition containing Windows or partitions with user data (if there are any).
Then select a partition to delete:
Select partition 1
and delete it
Delete partition override
Make sure that the only partition left is that containing Windows
List partition
Now we can create the EFI and MSR partitions again, manually. In order to do so, perform the following commands one by one in diskpart utility:
Choose a disk
select disk 0
create partition efi size=100
Make sure that the 100 Mb partition is selected (asterisk)
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, the partition containing Windows has already been assigned the letter C:, if that is not correct, the assign a letter to the partition in the following way
select vol 1
assign letter=C
exit
Copy files of the EFI environment from the directory where Windows 10 is installed:
mkdir G:\EFI\Microsoft\Boot
xcopy /s C:\Windows\Boot\EFI\*.* G:\EFI\Microsoft\Boot
Create again the configuration of Windows 10 boot loader:
g:
cd EFI\Microsoft\Boot
bcdedit /createstore BCD
bcdedit /store BCD /create {bootmgr} /d "Windows Boot Manager"
bcdedit /store BCD /create /d "Windows 10" /application osloader
The command returns GUID of the created record, and in the following command this GUID should be inserted instead of {your_guid}:
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}
Further commands are executed in the context {default}
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
Restart your computer … In our case, it did not load properly from the first time, so we had to do apply some IT quackery magic:
- Disconnect the power cord from the computer.
- Disconnect your hard disk drive (physically).
- Switch on the computer, wait until the boot error message window appears and switch it off again.
- Connect the hard disk drive.
Then in our case (we ran this test on VMWare virtual machine with UEFI environment) we had to add a new boot item into the menu by selecting the file EFI\Microsoft\Boot\bootmgrfw.efi in EFI partition.
After all described steps Windows 10 should load correctly. If you need to recover lost data from HDD use Hetman Partition Recovery.
I really love your site.. Pleasant colors & theme. Did you make this amazing site yourself? Please reply back as I'm hoping to create my own personal blog and would like to find out where you got this from or exactly what the theme is called. Appreciate it!
Thank you)
Thanks a lot! Saved me from reinstalling my pc! I didn't need to disconnect my drive.
We are glad that our article was helpful for you. If you have any questions, we will gladly answer them. https://www.youtube.com/channel/UCu-D9QnPsAPn7AtxL4HXLUg
Hello, could you please tell me how to create the 1st partition, which windows 10 creates in the name of Recovery Partition of size around 529 mb and formated as ntfs. Thank you!
This 1st partition is created during installation in automatic mode. On the step, than You select the C drive for the installation.
Worked also very well fo win server 2019. THANKS a lot !
THANK YOU! You saved my laptop when all hope were gone
wow you are my Laptop Saver... :=)
Always happy to help!
First and foremost, thank you very much for posting this usefull information. I have followed all the steps in this guide carefully, however I'm just not there yet. I know it's been mentioned before but could you please explain me how to: "add a new boot item into the menu by selecting the file EFIMicrosoftBootbootmgrfw.efi in EFI partition"? Should I put some more input into Command Prompt? Start Up repair didn't solve the problem in my case. Any help would be much appreciated.
Procedure works for Windows 7 through 10. The very last step, physically disconnecting the main hard drive, is necessary. If your EFI partition remains intact and only the files in an EFI partition have been corrupted or deleted, then the entire first part of the procedure, for recreating the EFI partition, may be skipped. This procedure saved me from what might have been an entire week of reconstructing one intricate "Windows 7" installation. We are all indebted for this comprehensive guide.
Thank you very much Sir. The best article in case of deleted EFI partition, bookmarked
for me the steps worked in a KVM environment rebooting back into the windows 10 startup disk and running Troubleshoot > Advanced Options > Startup Repair enabled the volume to boot with UEFI after running all of these instructions "Then in our case (we ran this test on VMWare virtual machine with UEFI environment) we had to add a new boot item into the menu by selecting the file EFIMicrosoftBootbootmgrfw.efi in EFI partition."
Smartest! Thank you ❤️
Thank you very much! I tried numerous methods to recover my deleted EFI partition; this is the only one that worked. Oh, yeah, it was me who deleted it.
Thanks,I spent whole day to recover partition table that got messed up, didn't wanted to setup from scratch. Your post helped in the end to get it working.
great guide; thanks a lot; I've been googling for a solution all day and none were actually working. This worked liked a charm.
Hi there! Love the work you out into making such a concise and clear guide to this process. I am having trouble with creating the msr partition of 128mb. I'm guessing there is insufficient space (not sure why, we're replacing whatever partition we delete here) so I'm wondering if there is something I can do to make the room or any other suggestions would be helpful. Thank you.
Never mind, my machine was creating the 100mb partition in the 128mb "hole" (created when deleting the partitions) which left the new 128mb partition for the 100mb hole which of course didn't fit. So I reversed the order of creating the partitions, the 128mb one and then the 100mb one and everything fits now.
for window 10 winload.efi is located in WindowsSystem32Boot folder So bcdedit /store BCD /set {default} path WindowsSystem32Bootwinload.efi works otherwise missing at startup
I've followed the instructions but upon booting get the error Your PC/Device needs to be repaired. The boot onfiguration data for your PC is missing or contains errors. The only step I didn't follow was this as I didn't understand it: Then in our case (we ran this test on VMWare virtual machine with UEFI environment) we had to add a new boot item into the menu by selecting the file EFIMicrosoftBootbootmgrfw.efi in EFI partition. Can you explain please? :)
Very informative article with step-by-step instructions. But does this work only for Windows 10?
Great article. However, I get "access denied" when trying to copy the efi files. Any ideas?
I think you must use a command bcdboot ti cope EFI. See help for this command.
How can a user prevent accidentally deleting a partition in the future?
Is it possible to recover data from a deleted partition even if the partition table is damaged?
Yes, it is possible to recover data from a deleted partition even if the partition table is damaged. There are data recovery tools available that can scan the drive and attempt to recover data from deleted partitions. However, the success of the recovery may depend on the extent of the damage to the partition table.
What steps should be taken before attempting to recover a deleted partition?
What are some recommended partition recovery software options for Windows?
Are there any risks involved in using partition recovery software?
Yes, there are risks involved in using partition recovery software. If the software is not used properly, it can cause data loss or corruption. Additionally, the software may not be able to recover all of the data that was lost, and some of the recovered data may be corrupted. It is also possible for the software to cause damage to the hard drive or other hardware components. Therefore, it is important to use caution when using partition recovery software.
Read how to restore the structure of deleted EFI partitions in Windows. If you do have any questions, don't hesitate to contact our technical support service - we will be happy to help you.