Repair Corrupted EFI System Partition in UEFI

A corrupted EFI System Partition (ESP) prevents UEFI-based computers from locating the bootloader and loading the operating system. This guide provides a step-by-step procedure to access a live recovery environment, identify the damaged FAT32 partition, and rebuild the boot files for both Windows and Linux installations.

Prerequisites

  1. A bootable USB drive containing either official Windows installation media or a live Linux distribution (such as Ubuntu).
  2. The motherboard UEFI/BIOS configured to boot the USB drive in native UEFI Mode (disable Legacy/CSM mode to ensure EFI boot paths are registered correctly).

Repairing the EFI Partition on Windows

1. Boot and Access the Command Prompt

  1. Insert the Windows installation media and boot your system.
  2. Select your language preferences, click Next, and then select Repair your computer in the bottom-left corner.
  3. Navigate to Troubleshoot > Advanced options > Command Prompt. Alternatively, press Shift + F10 on the initial setup screen.

2. Identify the Partitions

Use the DiskPart utility to locate your Windows volume and the EFI partition:

diskpart
list disk
select disk 0
list volume

(Replace 0 with the disk number containing your OS if multiple drives are installed.)

Look for two key volumes:

  • The primary Windows installation volume (note its drive letter, usually C: or D: in recovery).
  • The EFI volume (formatted as FAT32, typically between 100 MB and 500 MB, with no drive letter assigned).

3. Assign a Letter and Repair

Assign a drive letter to the EFI volume to make it accessible:

select volume <volume_number_of_EFI>
assign letter=S:

If the partition file structure is corrupted beyond standard repair, reformat the EFI partition as FAT32:

format fs=fat32 quick

Exit the DiskPart utility:

exit

4. Rebuild the Boot Configuration Data (BCD)

Generate fresh UEFI bootloader files on the EFI partition pointing to your Windows installation:

bcdboot C:\Windows /s S: /f UEFI

(Replace C:\Windows with the actual path identified in step 2 if different.)

Once the message "Boot files successfully created" appears, close the Command Prompt and reboot your system.


Repairing the EFI Partition on Linux

1. Boot into the Live Linux Environment

  1. Insert your live Linux USB, boot into UEFI mode, and select Try Ubuntu (or the equivalent live desktop/shell for your distribution).
  2. Open a terminal window.

2. Locate Partitions

List your storage devices to identify the root filesystem and the EFI System Partition:

sudo fdisk -l
  • Identify the Linux root partition (e.g., /dev/nvme0n1p2 or /dev/sda2).
  • Identify the EFI System Partition marked as EFI System (e.g., /dev/nvme0n1p1 or /dev/sda1).

3. Mount Partitions and Chroot

Mount the root filesystem, the EFI partition, and necessary virtual filesystems to create a chroot environment:

sudo mount /dev/sdX2 /mnt
sudo mount /dev/sdX1 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt

(Replace /dev/sdX2 with your root partition and /dev/sdX1 with your EFI partition.)

4. Reinstall and Update GRUB

Reinstall the GRUB bootloader directly to the EFI partition and update its configuration:

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --recheck
update-grub

5. Exit and Reboot

Exit the chroot environment, unmount the volumes, and restart:

exit
sudo umount -R /mnt
sudo reboot

Remove the installation media. The UEFI firmware will now detect the regenerated boot entry and boot into the operating system normally.