After a botched arch Linux install, my whole ssd got wiped. I used a bootable USB drive for Ubuntu to see what happened and saw that all my partitions from the SSD had vanished and the drive was showing up as free space. I am loading up internet recovery but I am not sure what I'll do there.

Everything went to hell after I typed parted mklabel gpt /dev/disk2 or something similar along these lines.

I don't care about recovering my data but all I want is my MacBook to boot up again

System: MacBook Pro Retina Display late 2011

  • Depends on what the installer tried to do. I've seen nix installers completely wipe & repartition the drive for their own use. What you do next depends on how recent your backup is.
    – Tetsujin
    Commented Aug 14, 2016 at 17:06
  • @Tetsujin what if I don't have another backup. Commented Aug 14, 2016 at 17:12
  • @klanomath All my data HAS been erased and I don't care at this point, just want my MacBook to boot up again Commented Aug 14, 2016 at 17:28
  • @klanomath how would one do that? You have given me hope :) Commented Aug 14, 2016 at 17:31
  • @klanomath Yes it did. The installed OSX was el Capitan 11.2 I think. I am not sure about the version number but surely was el Capitan Commented Aug 14, 2016 at 17:35

1 Answer 1


Granted that gparted didn't erase/secure erase data (overwriting important parts of your disk with zeros or arbitrary data) you probably can recreate the old standard GUID partition table which follows a fixed Apple scheme. gparted or similar gpt partitioning executables usually only modify the first and last 34 blocks (512 B) or 6 blocks (4096 B) of a disk.

The fast approach below won't work, if you've modified the disk previously (e.g installed Windows, resized the main volume and added a second partition). It only works with the "vanilla" OS X install partition scheme.

Recreating the old GUID partition table should restore the previous volume(s). Here is a related answer: HFS+ invalid number of allocation blocks.

The standard Apple GUID partition scheme looks like that:

                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  part2-size      2  GPT part - partition type
part2-size+409640     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
    total_size-40           7         
    total_size-33          32         Sec GPT table
     total_size-1           1         Sec GPT header

Here total-size is the total size of the disk in 512 B-blocks. part2-size usually is total-size - 1679216 in 512 B-blocks.

The partition type of the second partition is either 53746F72-6167-11AA-AA11-00306543ECAC (CoreStorage) or 48465300-0000-11AA-AA11-00306543ECAC (HFS+).

Newer systems on SSDs preferably have a CoreStorage- and older systems on HDDs an HFS+-type main partition.


  • Detach any external drive
  • Restart to Internet Recovery Mode by pressing alt cmd R at startup.

    The prerequisites are the latest firmware update installed, either ethernet or WLAN (WPA/WPA2) and a router with DHCP activated.
    On a 50 Mbps-line it takes about 4 min (presenting a small animated globe) to boot into a recovery netboot image which usually is loaded from an Apple/Akamai server.

    I recommend ethernet because it's more reliable. If you are restricted to WIFI and the boot process fails, just restart your Mac until you succeed booting.

    Alternatively you may start from a bootable installer thumb drive (preferably Yosemite or El Capitan) or a thumb drive containing a full system (preferably Yosemite or El Capitan). If you boot to a full system and login as admin you have to prepend sudo to execute some commands like gpt ... or newfs_hfs ...!

Remove the an old/wrong MBR/GUID partition table

  • Enter diskutil list and gpt -r show /dev/diskX (with x=0,1,2,3 etc) to get an overview. Usually the internal disk has the disk identifier disk0. Below I assume your internal disk is disk0.
  • Enter gpt destroy /dev/disk0 to remove any current GUID pt.
  • Enter gpt create -f /dev/disk0 to create a new empty GPT partition table and replace any MBR by an PMBR.

Restore previous partitions

  • EFI:

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

    Now do the math: the start block $sbrecovery of the Recovery HD is total-size - 1269576. $sbrecovery has to be dividable by 8!

    gpt add -b $sbrecovery -i 3 -s 1269536 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
  • Main volume

    Do the math again: the size of the volume $mainvolumesize is total-size - 1679216. $mainvolumesize has to be divisible by 8! Your main volume may either be a CoreStorage or a HFS+-type partition. Here I assume it's the first one:

    gpt add -b 409640 -i 2 -s $mainvolumesize -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
  • Now check if diskutil list finds a CoreStorage volume:

    diskutil cs list

    If the GUUID partition table is properly restored and your main partition was a CoreStorage volume you should get an output similar to this one:

      CoreStorage logical volume groups (1 found)
    +-- Logical Volume Group A629E051-D7B0-4B8C-A803-074F62704636
        Name:         System
        Status:       Online
        Size:         53946696192 B (53.9 GB)
        Free Space:   16777216 B (16.8 MB)
        +-< Physical Volume 90C09FC0-4215-4871-901B-70E2C9C7D464
        |   ----------------------------------------------------
        |   Index:    0
        |   Disk:     disk0s2
        |   Status:   Online
        |   Size:     53946696192 B (53.9 GB)
        +-> Logical Volume Family F6962E38-50E4-4458-BFE6-CF2E179352F5
            Encryption Status:       Unlocked
            Encryption Type:         None
            Conversion Status:       NoConversion
            Conversion Direction:    -none-
            Has Encrypted Extents:   No
            Fully Secure:            No
            Passphrase Required:     No
            +-> Logical Volume BD36C73D-860D-4DC6-B125-AD624F448B88
                Disk:                  disk2
                Status:                Online
                Size (Total):          53496696192 B (53.5 GB)
                Conversion Progress:   -none-
                Revertible:            Yes (no decryption required)
                LV Name:               System
                Volume Name:           System
                Content Hint:          Apple_HFS
  • verify the CoreStorage volume with

    diskutil verifyVolume diskX 

    (in the above CoreStorage example diskX is disk2 - check (Disk of Logical Volume), your diskX probably is disk14 or disk15)

If you get an error or no output your main volume either is a HFS+-type partition or the boundaries of the partition are wrong.

  • Then try the following and remove the CoreStorage-type partition and create an HFS+-type partition instead:

    gpt remove -i 2 /dev/disk0
    gpt add -b 409640 -i 2 -s $mainvolumesize -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
  • Verify the volume:

    diskutil verifyVolume /dev/disk0s2

If you run into problems or get strange errors please post a comment to the answer!

  • +1 as always. You're good at this stuff :) I do hope if ever I have an unbacked drive fall over at any point in future you're still here to help out.
    – Tetsujin
    Commented Aug 14, 2016 at 19:03
  • @Tetsujin My current average live expectancy according to Statistisches Bundesamt is 14.4 years. On the one hand I'm smoking - so it might be less - on the other hand I had a dream that I will die as a 93 year-old... ;-)
    – klanomath
    Commented Aug 14, 2016 at 19:10
  • Dammit... I might just outlive you.... well, maybe if I give up smoking. I'm hoping for the 'out of bell-curve' too, I'm thinking 117 might be a decent age to finally retire :)
    – Tetsujin
    Commented Aug 14, 2016 at 19:23
  • wow thanks for the help! I have an exam tomorrow so I have to study for it. I will definitely try this out tomorrow though. Commented Aug 15, 2016 at 1:35
  • who cares about the exam. I did what you said and my MacBook works! I think I formatted my drive a while back because the data isn't there but all is fine. Commented Aug 15, 2016 at 3:03

You must log in to answer this question.

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