5

When i press alt on my MacBook during startup, it only shows a disk that i used to have Windows installed (which is now empty). I erased that disk when i was last logged in on OS X. Then i tried to delete this partition and make the disk again as it was when i bought it 128GB.

There was an error. I thought that restart would be a good idea and that's what i did. Then what I wrote on first line happened. I just want some important files back; or reinstall OS X but keep old files.

Here are some photos I took. Recovery HD and Windows disks are empty, but I don't care about them.

disk0s2 is the disk i want to take files, it looks encrypted :(

enter image description here

Here is the result of sudo gpt -r show /dev/disk0:

gpt result

4
  • Are you sure that's all you did? What was the error & what exactly did you do. Specifics may be vital. Disk Utility by default, will not allow 6 partitions on a disk with Bootcamp.
    – Tetsujin
    Commented Dec 17, 2015 at 19:17
  • Ouch! Sorry, you need someone smarter than me to be able to sort that out. Wish you luck, but I really hope you have a backup.
    – Tetsujin
    Commented Dec 17, 2015 at 19:28
  • @klanomath Here is the output for disk0s2 that i want to get the files and Here is the output for disk0 you asked for. Thank you! Commented Dec 17, 2015 at 21:24
  • That's really a mess of a GUID partition table!
    – klanomath
    Commented Dec 17, 2015 at 21:46

1 Answer 1

2

The GUID partition table is a mess.

Just to explain all partitions:

  • i = 1 EFI partition
  • i = 2 main OS X volume (wrong partition type)
  • i = 3 Recovery HD (wrong partition type)
  • i = 4 Windows partition (wrong partition type)
  • i = 5,7 Linux partitions
  • i = 6 Linux Swap partition

I would do the following after booting to Internet Recovery HD:

  1. First you have to unmount disk0 and get the gpt table:

    diskutil umountDisk /dev/disk0
    gpt -r show /dev/disk0
    
  2. Open Utilities->Terminal and remove the two Linux partitions (5,7) and the Linux Swap partition (6) with:

    gpt remove -i 7 /dev/disk0
    diskutil umountDisk /dev/disk0
    gpt remove -i 6 /dev/disk0
    diskutil umountDisk /dev/disk0
    gpt remove -i 5 /dev/disk0
    
  3. Remove the Windows partition (marked as an Apple HFS+ partition)

    diskutil umountDisk /dev/disk0
    gpt remove -i 4 /dev/disk0
    
  4. Remove and properly re-add the Recovery HD:

    diskutil umountDisk /dev/disk0
    gpt remove -i 3 /dev/disk0
    gpt add -b 176870968 -i 3 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0
    
  5. Remove and properly re-add the OS X partition:

    diskutil umountDisk /dev/disk0
    gpt remove -i 2 /dev/disk0
    gpt add -b 409640 -i 2 -s 176461328 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
    

    the type of the partition may also be 53746F72-6167-11AA-AA11-00306543ECAC (CoreStorage). With on-board tool it's impossible to determine the correct partition type.

  6. Verify disk0 and disk0s2:

    diskutil verifyDisk /dev/disk0
    diskutil verifyVolume /dev/disk0s2
    

    If you get errors you may consider replacing the default partition type of disk0s2 by a CoreStorage volume:

    diskutil umountDisk /dev/disk0
    gpt remove -i 2 /dev/disk0
    gpt add -b 409640 -i 2 -s 176461328 -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
    

    Enter diskutil cs list. If you get No CoreStorage logical volume groups found as result repeat step 5 and continue with the diskutil verifyDisk... and diskutil repairDisk... steps below. If the diskutil cs list reveals a CoreStorage Volume Group check if it is encrypted: Logical Volume Family -> Encryption: locked. Unlock the volume with: diskutil cs unlockVolume lvUUID with lvUUID: the UUID of the Logical Volume and entering your passphrase.

    Verify disk0 and disk0s2 again:

    diskutil verifyDisk /dev/disk0
    diskutil verifyVolume /dev/disk0s2
    

    If you still get errors try to repair disk0 and disk0s2:

    diskutil repairDisk /dev/disk0
    diskutil repairVolume /dev/disk0s2
    
  7. Quit Terminal by entering exit and try to reboot to your main OS X volume

If you get an error saying disk0 Resource busy... you have to unmount disk0 again with diskutil umountDisk /dev/disk0.

10
  • [This] (imgur.com/a/vw2Bb) is what you asked ... Also on disk utility as you see things changed. Commented Dec 17, 2015 at 23:31
  • @AlexAndreadis Then Happy birthday to you... ;-)
    – klanomath
    Commented Dec 18, 2015 at 0:08
  • @AlexAndreadis Ok then all is fine. I didn't realize that you already rebooted to your main volume
    – klanomath
    Commented Dec 18, 2015 at 0:37
  • @AlexAndreadis The next step is now expanding your main volume to the full size of 120 GB. This works by booting to Internet Recovery Mode or an OS X Installer thumb drive, starting Terminal and entering diskutil cs resizeStack LVUUID 0g (with LVUUID = F312F6..........and so on)
    – klanomath
    Commented Dec 18, 2015 at 0:42
  • @AlexAndreadis I would download the OS X installer from the App Store and create a bootable thumb drive: Create a bootable installer for OS X. Boot to the thumb drive, partition the disk and install OS X. Then use the Migration Assistant to move all your apps and data from the Time Machine backup back to your Mac
    – klanomath
    Commented Dec 18, 2015 at 0:46

You must log in to answer this question.

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