Thursday, October 24, 2019

Windows 10 and EFI System Partitions

I recently was trying to swap some SSD drives between laptops and still keep the same OSes on the respective machines, which involved some backup and disk cloning.  That wasn't difficult, it was the point when I couldn't leave well enough alone, I saw one of the SSD drives with ~ 500MB of a FAT32 partition that was unused, so I figured I could move around some partitions using a partition editor to shuffle up the hidden partitions, and expand the main OS partition.  Well that was well and good until I tried slightly extending the EFI partition, and that broke a lot of stuff.   Then I realized the hard way that the EFI partition is a special partition that can't be cloned to from another disk image that has a good EFI partition.  (I didn't wan't to clone the entire drive again because there was more work I did on the new system that wasn't on the backup, silly me).

Thankfully, digging around the interwebs, I was able to find some resources from a few sites about EFI partitions and how to unfubar oneself.  (Credits and links to the original sites below):


Per Wikipedia: https://en.wikipedia.org/wiki/EFI_system_partition:
"The EFI (Extensible Firmware Interface) system partition or ESP is a partition on a data storage device (usually a hard disk drive or solid-state drive) that is used by computers adhering to the Unified Extensible Firmware Interface (UEFI)."


EFI should really be renamed Eventually Fubared Instantly.



If the EFI partition ever gets nuked, wrecked, or just plain fubar, consider running through these steps:


To Delete the EFI System Partition in Windows 10:
1. If you can't boot the system perform step 1a, then go to step 2.  If you can boot the system, skip step 1a and continue with step 1b:.

1a. Boot using a Windows 10 USB Key, selecting Repair;  Go to Advanced Tools and select a Command Prompt.  

1b. On the Start menu find and run the Command Prompt as Administrator

2. Run DISKPART, the Windows Disk Partition Tool
C:\> diskpart

On the DISKPART> prompt, go through the following steps:
3. List the disks that are detected:
DISKPART> list disk

4. After identifying the main disk containing the EFI partition (or where it used to be) select it:
DISKPART> select disk 1

5.List the disk partitions to identify which partition the EFI partition was or the partition you would like it to be:
DISKPART> list part

6. Select the partition:
DISKPART> select part 1

7. Delete the partition:
DISKPART> delete part



To Create the EFI System Partition in Windows 10:
1. If you can't boot the system perform step 1a, then go to step 2.  If you can boot the system, skip step 1a and continue with step 1b:.

1a. Boot using a Windows 10 USB Key, selecting Repair;  Go to Advanced Tools and select a Command Prompt.  

1b. On the Start menu find and run the Command Prompt as Administrator

2. Run DISKPART, the Windows Disk Partition Tool

On the DISKPART> prompt, go through the following steps:
3. List the disks that are detected:
DISKPART> list disk

4. After identifying the main disk containing the EFI partition (or where it used to be) select it:
DISKPART> select disk 1

5.List the disk partitions to identify which partition the EFI partition was or the partition you would like it to be:
DISKPART> list part

6. Select the partition:
DISKPART> select part 1

7. Create the partition:
DISKPART> create partition efi

8. Format the partition to FAT32:
DISKPART> format quick fs=fat32

9. Identify the volume where the Windows OS is installed (i.e. C:\WINDOWS).  Note the drive letter here may be different than C, this may be temporary:
DISKPART> list volume

10. Exit Diskpart and run the tool to copy the needed files to the EFT partition, noting the drive letter where Windows was installed on Step 9 above:  (Replace the D below with the proper drive letter):
C:\> bcdboot D:\windows

11:  Close out the command prompt and reboot the system, you should be good to go!


Credit to AnyRecover for their original instructions:
https://www.anyrecover.com/hard-drive-recovery-data/how-to-create-and-delete-efi-system-partition-in-windows/#tip1

No comments:

Post a Comment