accidentaly removed efi boot partition

hi guys,


I accidentally deleted EFI partition mac and now I can see the following when I run:


sudo gpt -r show disk0


Password:


      start       size  index  contents


          0          1         PMBR


          1          1         Pri GPT header


          2         32         Pri GPT table


         34          6         


         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B


     409640  157271616      2  GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF


  157681256        408         


  157681664    7548928      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC


  165230592     262144         


  165492736   70215864      4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC


  235708600    1269536      5  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC


  236978136          7         


  236978143         32         Sec GPT table


  236978175          1         Sec GPT header



so the 409640  157271616      2  GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF partition is unmounted and I can't access it.


Any help to get this partition accessible again? I'm looking forward to someone that could help me on this.


many thanks


Marco

Posted on Jan 13, 2021 3:04 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 13, 2021 9:09 AM

This looks like an APFS header. Run


sudo gdisk /dev/disk0

p (print)

t (change type)

2 (GPT2)

AF0A (Apple APFS)

p (print)

w (write)

y (yes)

q (quit, if necessary)


Reboot and test if you can see the APFS partition. Be aware that some versions of macOS have older APFS KEXTs which may not understand newer versions.


Similar questions

31 replies

Jan 13, 2021 3:36 PM in response to marks2510

marks2510 wrote:

sure:

Device Identifier:     disk1s5
  Device Node:        /dev/disk1s5
  Whole:           No
  Part of Whole:       disk1

  Volume Name:        Macintosh HD
  Mounted:          Yes
  Mount Point:        /

This output shows that disk1 is where your current root file system is. Since you are booted from it, and can see all your files, we will assume that this where all your data is.


You can check if disk2 has any data, before you delete it, using macOS Finder. After you have verified it, you can then run the deleteContainer command. Another option is to create a Time Machine backup of the Mac on an external disk, and then delete disk2, which will allow you to pull information from the backup of disk2, if you need it.

Jan 13, 2021 3:46 PM in response to Loner T

perfect, I did run the command and now diskutil list shows:


/dev/disk0 (internal, physical):

  #:            TYPE NAME          SIZE    IDENTIFIER

  0:   GUID_partition_scheme            *121.3 GB  disk0

  1:            EFI EFI           209.7 MB  disk0s1

  2:         Apple_APFS Container disk1     80.5 GB  disk0s2

  3:         Apple_HFS maverik         3.9 GB   disk0s3

  4:         Apple_HFS Untitled        36.5 GB  disk0s4


/dev/disk1 (synthesized):

  #:            TYPE NAME          SIZE    IDENTIFIER

  0:   APFS Container Scheme -           +80.5 GB  disk1

                 Physical Store disk0s2

  1:        APFS Volume Macintosh HD - Data   64.9 GB  disk1s1

  2:        APFS Volume Preboot         83.4 MB  disk1s2

  3:        APFS Volume Recovery        528.5 MB  disk1s3

  4:        APFS Volume VM           2.2 GB   disk1s4

  5:        APFS Volume Macintosh HD      11.0 GB  disk1s5

Jan 13, 2021 5:33 PM in response to Loner T

the 3 outputs:


diskutil eraseVolume free free disk0s3

Started erase on disk0s3 maverik

Unmounting disk

Finished erase on disk0

marcos****@Marcos-MacBook-Pro-13 ~ % diskutil eraseVolume free free disk0s4

Started erase on disk0s4 Untitled

Unmounting disk

Finished erase on disk0


---------------------------------------


diskutil eraseVolume free free disk0s4

Started erase on disk0s4 Untitled

Unmounting disk

Finished erase on disk0


----------------------------------------


diskutil apfs resizeContainer disk1 0g

Started APFS operation

Aligning grow delta to 40,600,002,560 bytes and targeting a new physical store size of 121,123,069,952 bytes

Determined the maximum size for the targeted physical store of this APFS Container to be 121,122,041,856 bytes

Resizing APFS Container designated by APFS Container Reference disk1

The specific APFS Physical Store being resized is disk0s2

Verifying storage system

Using live mode

Performing fsck_apfs -n -x -l -S /dev/disk0s2

Checking the container superblock

warning: container has been mounted by APFS version 1412.141.1, which is newer than 1412.120.2

warning: disabling overallocation repairs by default; use -o to override

Checking the EFI jumpstart record

Checking the space manager

Checking the space manager free queue trees

Checking the object map

Checking volume

Checking the APFS volume superblock

The volume Macintosh HD - Data was formatted by diskmanagementd (1412.120.2) and last modified by apfs_kext (1412.141.1)

Checking the object map

Checking the snapshot metadata tree

Checking the snapshot metadata

Checking the extent ref tree

Checking the fsroot tree

Checking volume

Checking the APFS volume superblock

The volume Preboot was formatted by newfs_apfs (748.77.8) and last modified by apfs_kext (1412.141.1)

Checking the object map

Checking the snapshot metadata tree

Checking the snapshot metadata

Checking the extent ref tree

Checking the fsroot tree

Checking volume

Checking the APFS volume superblock

The volume Recovery was formatted by newfs_apfs (748.77.8) and last modified by apfs_kext (1412.120.2)

Checking the object map

Checking the snapshot metadata tree

Checking the snapshot metadata

Checking the extent ref tree

Checking the fsroot tree

Checking volume

Checking the APFS volume superblock

The volume VM was formatted by newfs_apfs (748.77.8) and last modified by apfs_kext (1412.120.2)

Checking the object map

Checking the snapshot metadata tree

Checking the snapshot metadata

Checking the extent ref tree

Checking the fsroot tree

Checking volume

Checking the APFS volume superblock

The volume Macintosh HD was formatted by diskmanagementd (1412.120.2) and last modified by apfs_kext (1412.141.1)

Checking the object map

Checking the snapshot metadata tree

Checking the snapshot metadata

Checking the extent ref tree

Checking the fsroot tree

Verifying allocated space

The volume /dev/disk0s2 appears to be OK

Storage system check exit code is 0

Growing APFS Physical Store disk0s2 from 80,523,067,392 to 121,123,069,952 bytes

Modifying partition map

Growing APFS data structures

Finished APFS operation



[Personal Information Edited by Moderator]

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

accidentaly removed efi boot partition

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.