My computer recently crashed very, very hard, while I was removing an small empty alternative OS partition I no longer needed. This is a fairly mundane operation that I do now and again, and is a ongoing fight to keep at least a few gigs of space free for actual work on precious 250gb Mac SSD.
The crash results? Toasted GPT tables all around. My 2015 computer’s next move was to reboot- only to find essentially no partitions of memory… at all. What it did show was (wait for it) Clover bootloader of all things, with a single windows boot camp icon (nothing in there either). That is so wrong…. On all levels!
I brought the machine to the local university repair. They declared this machine bricked and offered to wipe it. Back to me it came…
I scheduled an Apple support session with a phone rep, which after around 45 minutes of actually productive troubleshooting ideas (none helping though) was forwarded to a senior supervisor. She was interested in this problem, and we scheduled a larger block of time. But, in the meantime, I still wanted to try again….
How to recover a garbled GPT table for Mac OSX:
Start with clean SMC and PRAM / NVRAM.
Clearing these actually made accessing internet recovery (how we get to a stand-in OS with a terminal) dozens of times faster. 2.5 hours to 7 minutes. I actually waited 2.5 hours twice on separate attempts before I cleared these.
Follow these Apple links to perform these operations:
https://support.apple.com/en-us/HT204063
https://support.apple.com/en-us/HT201295
Get the computer with a text editor open.
Restart the computer into internet recovery. Command + R or Command + Shift + R.
Wait.
Open a Terminal. The graphical disk utility is useless because the disk / partition we want is unreachable(so it will say everything is great).
Run:
diskutil list
For me, I see disk0s2 is 180.6 gb. That’s my stuff!
I also found /dev/disk2 → /dev/disk14 to be tiny partitions- don’t worry about those.
The syntax you are looking for is:
Name: “untitled” Identifier: disk#
(NOT disk#s#)
Write down ALL of the above information for the disk you are after. That is probably disk0.
Then:
gpt -r show disk0
Copy the following readout in your terminal for all entries bigger than “32”. The critical fields here are Start, Size, Index, and Contents. Each field is supremely important.
Here is mine (formatted for web):
# Disk0, with contents > “32” :
# First Table:
Start: 40
Size: 409600
Index: 1
Contents: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
# Second table, the one with my data:
Start: 409640
Size: 352637568
Index: 2
Contents: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
Note, this is the initial Contents. I rewrote this once with the correct Apple Index 2 data but did not create a new table (leaving the rest of the broken bits broken). We are replacing / destroying a table here, but not the data.
Actions:
# unmount the disk. From here we are doing tables, not disks / data.
diskutil unmountDisk disk0
# Get rid of the GPT on the disk we are recovering. We are not touching the data.
gpt destroy disk0
# Make a new one to start with some fresh values.
gpt create -f disk0
# perform magic trick
# USE THE DATA YOU WROTE DOWN FROM “gpt -r show disk0”. THIS IS IMPORTANT.
# we must add that first small partition at index 1. Verbatim.
gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0
# index two (for me) is my data. We are going to use the default OSX / Mac HD partition values.
# the Length of “372637568” is not as sure fire as the GPT Contents.
# YMMV, but YOLO.
gpt add -i 2 -b 409640 -s 372637568 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0
Again, that Contents value is 7C3457EF-0000-11AA-AA11-00306543ECAC.
– Jess
written in the recovered computer xD
Jess the God bless you! You save my life! Have a fabulous life!
Thank you so much ??
THANKS JESS