1

MacBook Pro 2015. I recently dual-booted my Mac with Linux for school however I changed my mind on which distro to run and figured the best way to change would be to format and remove the Linux partitions and start over.

After I formatted the partitions I attempted to remove them but only one could be deleted and it turned into one 24.4gb partition which would give me an error everytime I tried to delete it and merge the partition back into a single Macintosh HD volume. I also noticed my boot volume was showing as 'ahfs' and not 'apple_boot' and my Macintosh HD volume was showing as 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFF' so I followed a guide to change the boot drive back to 'apple_boot' and attempted to follow this guide (Data Not Backed Up, Partition Type: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF) and made it to gpt add -i 3 -b 188093184 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0

This command returned erorrs:

gpt add: disk0: Suspicious MBR at sector 0    
gtp add: disk0: error: no space available on drive     

I researched ways to fix it and came up with this solution,

gpt destroy /dev/disk0         

but received an error of suspicious MBR at sector 0 so I removed the hybrid MBR with

fdisk -i -a hfs /dev/disk0 

and received

fdisk: could not open MBR file /use/standalone/i386/boot0: No such file or directory 

ATTENTION - UPDATING MASTER BOOT RECORD 

Do you wish to write a new MBR and partition table? [n] 

I entered y and received no confirmation.

I then tried to add back my partitions with

gpt add -b 40 -s 409600 -i 1-t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0 

and received the erorrs:

gpt add: error: bogus map
gpt add: unable to open device '/dev/disk0': Undefined error: 0

Now when I am stuck with both the bogus map and undefined error 0 error everytime I attempt gpt show or gpt add.

Is there anyway to recover my data? I went to go get my backup HDD out of the office but my little brother had dropped it in soda a few weeks ago and told no one so it's useless. Any tips would be greatly appreciated!

  • Did you recreate the GUID Partition Table after destroying it? By the way, this answer may help you: How to fix broken GPT, GUID and unmountable, no type volumes? – pixelomer Jan 24 '18 at 8:07
  • i attempted "gpt create -f /dev/disk0" and received "gpt create: error: bogus map" and "gpt create: unable to open device '/dev/disk0': undefined erorr: 0'. I also attempted to follow the guide but this is the point where it become irrelevant as it's methods do not work. thanks for the response, right now I'm waiting for macOS installer to load on my sisters computer so I can create a bootable USB and use a GPT recovery program called remorecover to access and copy my data from a fresh install of macOS. i'll check back in after to notify if it works incase anyone goes through the same problem – AceHyte Jan 24 '18 at 8:49
  • @klanomath do you mean make a bootable USB and you'll remotely recover my MBP? that's awesome thank you so much. what OS should I grab? – AceHyte Jan 24 '18 at 13:13
  • @klanomath Okay, working on installing Sierra on an external drive now. Will reply back when completed. thanks for the advice and hopefully we can fix this soon. – AceHyte Jan 24 '18 at 13:21
1

The disk lost any gpt partition in the partition table because the secondary GPT mismatched the primary GPT (and its CRC was wrong) and thus was bogus.

To recover everything the following was done:

  • boot to a working external macOS boot disk
  • get the details:

    diskutil list
    gpt -rvvv show disk0
    fdisk /dev/disk0
    diskutil umountDisk0
    
  • completely zero out the 1st and 2nd GPT and the MBR:

    dd if=/dev/zero of=/dev/disk0 count=34 bs=512
    dd if=/dev/zero of=/dev/disk0 seek=(size_of_disk_in_blocks-33) count=33 bs=512
    
  • create a new gpt:

    gpt create -f /dev/disk0 
    
  • add all partitions

    gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0
    
  • a hexdump of block 409640 revealed a CoreStorage partition - a pic taken by the OP before, suggested a size of 187683544 blocks for the second partition:

    gpt add -i 2 -b 409640 -s 187683544 -t 53746F72-6167-11AA-AA11-00306543ECAC
    

    the volume verified with 0 errors and had to be unlocked: the volume is encrypted!

  • Tried to restore a previous recovery partition:

    gpt add -i 3 -b 188093184 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC
    diskutil verifyVolume disk0s3
    

    No file system was detected; the diskutil verifyVolume command failed. The recovery partition and its content was deleted previously. The third partition has to be removed again:

    gpt remove -i 3 disk0
    
  • Since the recovery partition - usually containing an intermediate FV key required while booting to FV - is missing, the main volume was reverted to HFSJ:

    diskutil cs list #get the lvUUID of the main volume
    diskutil cs revert lvUUID #old (admin) password needed to unlock the volume
    
  • The volume was expanded

    diskutil resizeVolume disk0s2 0
    diskutil verifyVolume disk0s2
    
  • Booted to the restored and expanded main volume the system (Sierra 10.12.6) was reinstalled to restore the missing recovery partition.
  • Re-enable FileVault.

You must log in to answer this question.

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