4 C
United States of America
Saturday, November 23, 2024

macos – Restore partitions desk


  • Disclaimer0: Following steps is probably not legitimate for different macs or different variations of MacOS, i am utilizing Macbook Professional 16″ 2019, MacOS Ventura 13.1
  • Disclaimer1: Possibly this isn’t the very best answer, simply my expertise of fixing the issue.

So, answering to myself.

After a number of hours of messing with gpt command, these steps helped me out:

  1. Dont neglect to execute gpt -r present disk0 and bear in mind printed end result

  2. diskutil unmountDisk disk0 – unmount disk to change GPT

  3. gpt destroy disk0 – delete outdated GPT

  4. gpt create disk0 – create new GPT

  5. gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0 – add report for EFI (however the “begin” and “measurement” is flawed at this second)

  6. diskutil unmountDisk disk0 – After EFI added, the partition mounts, so unmount disk to change GPT

  7. gpt add -i 2 -b 409640 -s 95361496 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0 – add APFS (however the “begin” and the “measurement” is flawed at this second).

    95361496 = 95771136 (ExFAT begin) – 409640 (EFI finish)

So, at this second i’ve 2 data – EFI and APFS. I returned again to Disk Util and noticed APFS partition exhibits as “disk0s2”, and can’t be mounted. First Assist detects downside with EFI, so we have to repair it.

I returned to Terminal, and executed diskutil repairDisk disk0. It requested me to permit rewrite of EFI partiton.

I executed gpt -r present disk0 and that i noticed one thing unusual: measurement of EFI partiton was decreased to 76800, “begin” modified to 6, and free area appeared between EFI (1) and APFS (2).

I deleted APFS report:

diskutil unmountDisk disk0
gpt take away -i 2 disk0

And recreated with new begin level and measurement:

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

95694330 = 95771136 (ExFAT begin) – 76806 (EFI finish)

And voila: diskutil listing exhibits all of my APFS containers (Macintosh HD and others)

On the finish, add ExFAT report:

gpt add -i 3 -b 95771136 -s 26366976 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0

Now i can boot to MacOS 🙂

Observe: Fortunately ExFAT report wasn’t deleted originally, so that is the important thing to the entire answer, overwise i do not know the best way to decide the place APFS partition “ends” and the place ExFAT partition “begins”

Report varieties:

ExFAT - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
APFS - 7C3457EF-0000-11AA-AA11-00306543ECAC 
EFI - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 

gpt command flags:

-i - report index
-b - "begin" of partition
-s - "measurement" of partition
-t - kind of report 

So, simplified posible answer (ONLY IF YOU HAVE APFS ONLY OR APFS AND EXFAT, BUT EXFAT RECORD NOT DELETED):

gpt -r present disk0TAKE A PHOTO OF PRINTED RESULT

diskutil unmountDisk disk0
gpt destroy disk0
gpt create disk0
gpt add -i 1 -b 6 -s 76800 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0
diskutil unmountDisk disk0
gpt add -i 2 -b 76806 -s **APFS_SIZE (SEE BELOW)** -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0

// IF YOU HAD EXFAT PARTITION, SKIP IF NOT
diskutil unmountDisk disk0
gpt add -i 3 -b *EXFAT_PARTITION_START* -s *EXFAT_PARTITION_SIZE* -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0

About APFS_SIZE:

  • If you happen to had ExFAT partition after APFS partition:

    APFS_SIZE = EXFAT_PARTITION_START - 76806

  • If you happen to had APFS partition solely :

    • APFS_SIZE = "Sec GPT desk" begin - 76806
    • OR (attempt completely different)
    • APFS_SIZE = "Sec GPT desk" begin - 76806 - 16

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles