Mac EFI partition in wrong place (disk0s2 not disk0s1)

efimacmacospartition

Here is my problem:
My EFI partition works fine, but it is in the wrong location (it is at disk0s2 instead of disk0s1 as you will see in the picture).

How can I fix this?

I do not want to delete both disk0s1 and disk0s2 and then create a new EFI partition in the right disk0s1 location, since I am afraid that deleting disk0s1 will result in problems.

Thanks in advance!

diskutil list
diskutil list

sudo gpt -r show disk0
sudo gpt -r show disk0

diskutil list internal and gpt -r show disk0
Edit: diskutil list internal and gpt -r show disk0 in recovery mode (sorry for quality)

Best Answer

I posted this answer since the steps fulfill your requirement given below.

I do not want to delete both disk0s1 and disk0s2 and then create a new EFI partition in the right disk0s1 location, since I am afraid that deleting disk0s1 will result in problems.

Below are the steps needed to correct your problem.

  1. Boot the Mac to a version of macOS Recovery that is the same version or newer than the macOS you are using. You do not have to use internet recovery. The recovery that is already on your internal drive should work just as well.

  2. Open a Terminal window and enter the command below to confirm the ProductVersion shows the same version or newer than the macOS you are using.

    sw_vers
    
  3. Enter the command given below to add a new EFI partition as the third entry in the GPT.

    gpt -f add -i 3 -b 6 -s 76800 -t efi disk0
    

    Note: This will result in GPT entries that are no longer in ascending order. This will be fixed in a later step.

  4. Enter the command given below to format the new EFI partition.

    newfs_msdos -F 32 -v EFI /dev/rdisk0s3
    
  5. Restart back to macOS.

  6. Open a Terminal window and enter the command below. Confirm disk0s2 has a TYPE of EFI and a NAME of NO NAME.

    diskutil list
    
  7. Enter the command below to remove the original EFI partition. This command will also arrange the GPT entries in ascending order without changing the identifiers disk0s1 and disk0s3.

    diskutil erasevolume free none disk0s2
    
  8. Restart the Mac to reassign the identifiers in ascending order.


I neglected to include a step where any of the contents of the old EFI partition is copied to the new EFI partition. I doubt there is anything worth copying. However if you want to try, then after step 6, use the commands below to mount the two EFI volumes.

sudo diskutil mount disk0s2
sudo diskutil mount disk0s3

After you are finished copying, use the commands below to unmount the two EFI volumes.

diskutil unmount disk0s2
diskutil unmount diks0s3

Proceed to step 7.