In this article, we will walk through the process of recovering an accidentally deleted EFI partition in Ubuntu 20.04. This is a complex process that involves creating a new EFI partition, setting the EFI and boot flags, and installing the GRUB bootloader.
Recovering from an accidentally deleted EFI partition in Ubuntu 20.04 involves creating a new EFI partition, setting the EFI and boot flags, and installing the GRUB bootloader. It is a complex process that requires booting from a live Ubuntu USB, using the parted utility to create a new partition, installing the GRUB bootloader, and rebooting the system.
What is an EFI Partition?
The EFI partition, also known as the EFI System Partition (ESP), is a small partition on your hard drive that stores the bootloader. The bootloader is a program that your computer’s firmware runs to start the operating system. If you accidentally delete the EFI partition, your system will not be able to boot.
Identifying the Problem
If you have accidentally deleted the EFI partition, your system will likely display a message such as “no bootable device found” when you attempt to boot. You can confirm the problem by booting from a live Ubuntu USB stick and running the
fdisk -l command in a terminal. If the EFI partition is missing, it will not be listed.
Recovering the EFI Partition
Step 1: Boot from a Live Ubuntu USB
To recover the EFI partition, you will first need to boot your system from a live Ubuntu USB stick. This will allow you to access your hard drive and create a new EFI partition.
Step 2: Create a New EFI Partition
Once you have booted from the live USB, open a terminal and run the
sudo parted command. This will open the parted utility, which you can use to manage your partitions.
In the parted utility, use the
print devices command to list your devices. Identify the device that is missing the EFI partition and select it using the
Next, use the
You can now create a new partition in the unused area using the
mkpart command. For example, if your unused area is from 1MB to 500MB, you would run
mkpart EFI fat32 1MB 500MB. This creates a new partition named “EFI” with the FAT32 file system.
Finally, set the EFI and boot flags on the new partition using the
set command. For example, if your new partition is number 1, you would run
set 1 boot on and
set 1 esp on.
Step 3: Install the GRUB Bootloader
With the new EFI partition created, you now need to install the GRUB bootloader. To do this, exit the parted utility and run the
sudo grub-install /dev/sda command, replacing “/dev/sda” with the device identifier for your hard drive.
Note that simply running the
update-grub command will not repopulate the EFI partition with the necessary bootloaders. You must use the
Step 4: Reboot Your System
After installing the GRUB bootloader, you can reboot your system. If everything has been done correctly, your system should now be able to boot normally.
Recovering an accidentally deleted EFI partition in Ubuntu 20.04 is a complex process, but it is possible with the right tools and knowledge. If you are not comfortable performing these steps yourself, consider seeking help from a professional. Always remember to back up your important data before making any changes to your system.
No, you will need to boot from a live Ubuntu USB in order to access your hard drive and create a new EFI partition.
You can create a live Ubuntu USB by downloading the Ubuntu ISO file from the official website and using a tool like Rufus or Etcher to create a bootable USB drive.
Recovering the EFI partition should not delete your data. However, it is always recommended to back up your important data before making any changes to your system, just to be safe.
Yes, you can use other partitioning tools like GParted or fdisk to create a new EFI partition. The steps may vary slightly depending on the tool you choose.
If you encounter any errors during the recovery process, it is recommended to seek help from a professional or consult the Ubuntu community forums for assistance.