Mac EFI partition in wrong place (disk0s2 not disk0s1)
I posted this answer since the steps fulfill your requirement given below.
I do not want to delete both
disk0s1
anddisk0s2
and then create a new EFI partition in the rightdisk0s1
location, since I am afraid that deletingdisk0s1
will result in problems.
Below are the steps needed to correct your problem.
-
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.
-
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
-
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.
-
Enter the command given below to format the new EFI partition.
newfs_msdos -F 32 -v EFI /dev/rdisk0s3
-
Restart back to macOS.
-
Open a Terminal window and enter the command below. Confirm
disk0s2
has aTYPE
ofEFI
and aNAME
ofNO NAME
.diskutil list
-
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
anddisk0s3
.diskutil erasevolume free none disk0s2
-
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.
Just for comparison here are the diskutil
and gpt
output for my very standard layout.
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.3 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 500.0 GB disk0s2
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 4 Pri GPT table
6 76800 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
76806 122061321 2 GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
122138127 4 Sec GPT table
122138131 1 Sec GPT header
There are few non-standard things in your disk.
- Your EFI should be in the 76800 size partition.
- The EFI partition should have a name.
- The EFI partition is smaller than mine.
- You have some free space - maybe the remnant of a non-macOS installation.
It might be possible to move the EFI partition, but I leave that to someone more knowledgeable.
My advice (what I would do):
- Backup everything using Time Machine (or your backup/recovery solution of choice). Double check that you have a good backup.
- Boot to Recovery mode.
- Erase the whole disk.
- Install macOS from the Internet.
- Recover your apps, settings and data from backup using Migration Assistant.
Then you would have the standard disk layout.