How to rebuild/recreate the EFI system partition (ESP) manually?

April 19, 2025, Posted by Admin to EFI System Partition management

The ESP partition stores boot files (such as bootx64.efi, Windows Boot Manager, etc.) necessary for UEFI booting. If the files are mistakenly deleted, corrupted, or infected by viruses, it will cause the system to fail to boot, and you will need to rebuild the partition to recover the boot files. This tutorial details how to rebuild/recreate the ESP partition manually with diskpart and bcdboot, you can do this in Windows or WinPE.

 

Tutorial to rebuild/recreate the EFI system partition (ESP) manually.

Step 1. Open an elevated cmd.exe in Windows.

Step 2. Run diskpart and enter list disk.

list disk in diskpart

Step 3. Enter sel disk x. x is the number of the disk you want to rebuild the ESP on as listed in the previous step. For example, I want to rebuild the ESP on disk 2, so I enter sel disk 2.

select disk in diskpart

Step 4. Enter list part to view the partition number of the ESP to be rebuilt.

list partition in diskpart

Step 5. Enter sel part x. x is the number of the ESP listed in the previous step. My ESP partition (Windows Disk Management shows it it a 99 MB partition) number in this example is 2.

select partition in diskpart

Step 6. Enter format fs=fat32 to format the selected partition to FAT32 format.

format as fat32 in diskpart

Step 7. Enter assign letter=x to assign a drive letter to this ESP. x is the drive letter you want to assign to the ESP. In this example, the drive letter I assigned to the ESP is I:.

assign drive letter in diskpart

Step 8. Enter exit to exit diskpart.

exit diskpart

Step 9. Enter bcdboot w:\Windows /s x: to to rebuild the ESP partition. x is the drive letter you assign to the ESP, w is the drive letter of the Windows partition on the disk where you want to rebuild the ESP. In this example, the drive letter I assigned to the ESP is I:, the drive letter of the Windows partition is F:.

rebuild ESP with bcdboot
rebuild ESP disk layout

 

As described above, ESP partition corruption can cause us to not be able to boot Windows properly, and you can rebuild/recreate the ESP partition manually with diskpart and bcdboot. However the process is a bit more complicated in Windows and WinPE, fortunately you can easily rebuild the ESP partition with Hasleo EasyUEFI.

 

top