2

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)

4
  • Can you boot on external drive or in recovery mode and give the results of commands diskutil list internal and gpt -r show disk0
    – Jean_JD
    Jul 28 at 10:32
  • @Jean_JD Of course, you should see it now. Jul 28 at 13:02
  • Which version of macOS are you using? Jul 29 at 8:53
  • @DavidAnderson MacOS Big Sur Version 11.5.1 Jul 31 at 14:51
4

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.

2

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.

  1. Your EFI should be in the 76800 size partition.
  2. The EFI partition should have a name.
  3. The EFI partition is smaller than mine.
  4. 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):

  1. Backup everything using Time Machine (or your backup/recovery solution of choice). Double check that you have a good backup.
  2. Boot to Recovery mode.
  3. Erase the whole disk.
  4. Install macOS from the Internet.
  5. Recover your apps, settings and data from backup using Migration Assistant.

Then you would have the standard disk layout.

0
0

After a save of your system (Time Machine or Carbon Copy Cloner), boot from Internet Recovery Mode (cmd+alt+r at boot). Verify that the command :

diskutil list internal

give disk0 as internal disk.

If it's ok you can try this commands (if you got an error, you stop, give the information and wait) :

diskutil umountdisk disk0

then

gpt remove -i 1 disk0

then

diskutil umountdisk disk0

then

gpt remove -i 2 disk0

then

diskutil umountdisk disk0

then

gpt add -b 6 -i 1 -s 76800 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0

then

diskutil umountdisk disk0

then

gpt add -b 76806 -i 2 -s 89029882 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0

then

diskutil umountdisk disk0

then

gpt add -b 89106688 -i 3 -s 62464 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0

then you give the results of :

diskutil list internal

and

gpt -r show disk0
5
  • How do you propose to format your newly created EFI partition? Or, are you going to assume the original is still intact? Jul 29 at 3:46
  • Secondly, I will suggest formatting and copying the existing EFI partition to the new one, then deleting the EFI in position 3.
    – Jean_JD
    Jul 29 at 4:25
  • With macOS Recovery for Catalina, your third diskutil umountdisk disk0 command issues the message Unmount of disk0 failed: at least one volume could not be unmounted. Of course the message is wrong. At this point, there are no partitions. Still, there is no reason to issue the command. Jul 29 at 11:09
  • @David This is why I recommend booting in Internet recovery mode. Thanks for the correction ;-)
    – Jean_JD
    Jul 29 at 11:25
  • Hopefully, if the OP chooses to implement your answer and encounters the message, my comment will help explain why the message can be ignored. Jul 29 at 11:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .