1

I had a Linux/OS X 10.11 dual boot configuration and wanted to remove the Linux partitions. I managed to remove them without any issue but when trying to merge the free space with the OS X partition something went wrong (I used the disk utility only), and after a reboot this is now shown when looking for the different partitions :

-bash-3.2# diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF               170.4 GB   disk0s2
   3:                  Apple_HFS Recovery HD             649.1 MB   disk0s4
/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +2.1 GB     disk1
   1:                  Apple_HFS OS X Base System        2.0 GB     disk1s1

-bash-3.2# diskutil corestorage list
No CoreStorage logical volume groups found

I have found a similar issue but I am not familiar with OSX/BSD commands and I don't want damage anything : Diskutil can't find Core Storage Volumes

And i get roughly the same results :

-bash-3.2# fsck_cs /dev/disk0s2
   Executing fsck_cs (version 517.20.1)
** Checking volume
** Content Hint for disk0s2 is not Apple_CoreStorage
** disk0s2: Scan for Volume Headers
** disk0s2: Scan for Disk Labels
** Logical Volume Group 1AE35784-CFDF-445A-876D-23931CE9FB91 on 1 device
** disk0s2: Scan for Metadata Volume
** Logical Volume Group has a 24 MB Metadata Volume with double redundancy
Start scanning metadata for a valid checkpoint
** Load and verify Segment Headers
** Load and verify Checkpoint Payload
** Load and verify Transaction Segment
** Incorporate 0 newer non-checkpoint transactions
** Load and verify Virtual Address Table
** Load and verify Segment Usage Table
** Load and verify Metadata Superblock
** Load and verify Logical Volumes B-Trees
** Logical Volume Group contains 1 Logical Volume
** Load and verify 37BE577C-5FBD-4919-9864-C8501FD8E965
** Load and verify 9DE1F86F-7BFC-420F-B751-55D20B107137
** Load and verify Freespace Summary
** Load and verify Block Accounting
** Load and verify Live Virtual Addresses
** Newest transaction commit checkpoint is valid
** Load and verify Segment Cleaning
** The volume 1AE35784-CFDF-445A-876D-23931CE9FB91 appears to be OK

Could you please guide me through the steps described in the link above ? I am afraid of doing something wrong with the gpt and fdisk commands (I have read their BSD manuals but can't allow myself to lose the data on that disk).

Thank you in advance !

Progress

I tried to follow klanomath's (thanks a lot for answering so quickly) instructions but gpt gave me an error, here's exactly what i did :

-bash-3.2# gpt -r show /dev/disk0
gpt show: /dev/disk0: Suspicious MBR at sector 0
      start       size  index  contents
          0          1         MBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  332728384      2  GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
  333138024  155828120         
  488966144    1267712      4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  490233856        863         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header
-bash-3.2# diskutil unmountDisk /dev/disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# gpt remove -i 2 /dev/disk0
gpt remove: /dev/disk0: Suspicious MBR at sector 0
/dev/disk0s2 removed
-bash-3.2# diskutil unmountDisk /dev/disk0
Unmount of all volumes on disk0 was successful
-bash-3.2# gpt add -i 2 -b 409640 -s 332728384 -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
gpt add: /dev/disk0: Suspicious MBR at sector 0
gpt add: /dev/disk0: error: no space available on device

And now I get this :

-bash-3.2# gpt -r show /dev/disk0
gpt show: /dev/disk0: Suspicious MBR at sector 0
      start       size  index  contents
          0          1         MBR
          1     409639         
     409640  332728384      2  MBR part 218
  333138024  155828120         
  488966144    1267712      4  MBR part 175
  490233856        896         
-bash-3.2# diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *251.0 GB   disk0
   1:                       0xEE                         209.7 MB   disk0s1
   2:                       0xDA                         170.4 GB   disk0s2
   3:                  Apple_HFS Recovery HD             649.1 MB   disk0s4

I hope i didn't break anything... I have found another stackexchange question which seems to be quite similar : How to fix broken GPT, GUID and unmountable, no type volumes?

But I am afraid of breaking things down even more if trying that alone, and I don't understand in which order I should follow the different steps (removing MBR/damaged partitions/GUID recovery). I would highly appreciate any help on that again, thanks in advance !

Solution

Following the steps as described by klanomath I managed to recover that partition and save the files elsewhere. Note that I couldn't repair the disk after a verification through the disk utility, my guess is that the old version of the disk utility in the Internet recovery is not capable of doing that for something created with a recent version but I'm not sure about that.

Anyway, I got my data back, thanks a lot for your help klanomath !


The free space is the linux system I removed.

0

Your GUID partition table and the MBR are bogus. Your second partition disk0s2 has the wrong partition type. Instead of FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF the type should be 53746F72-6167-11AA-AA11-00306543ECAC.

To modify the partition table destroy and create a new proper one. Afterwards you have to re-add the partitions in the old boundaries but with proper types.

Preparation:

  • 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 bogus MBR/GPT and re-add the partitions

  • Open in the menubar Utlities->Terminal
  • Enter diskutil list and gpt -r show /dev/disk0 to get an overview
  • Destroy the bogus GUID partition table/MBR and recreate a fresh one:

    diskutil umountDisk /dev/disk0
    gpt destroy /dev/disk0
    diskutil umountDisk /dev/disk0
    gpt create -f /dev/disk0
    
  • Re-add the partitions but with a different type for the 2nd partition (i=2):

    gpt add -b 40 -i 1 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
    gpt add -b 488966144 -i 3 -s 1267712 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0
    gpt add -b 409640 -i 2 -s 332728384 -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
    
  • The logical volume should mount automatically if not encrypted. If not you may have to unlock it.

  • Verify the disk and the volume

Your disk contains some uncommon free space. Please ask a second question how to solve this or check other questions and answers here.

  • Thanks for your help ! I am now facing another issue : gpt tells me "Suspicious MBR at sector 0", there are more details in the main question. – tutzeroone Jun 3 '16 at 18:09
  • @tutzeroone Updated answer – klanomath Jun 3 '16 at 23:12
  • thank you very much for your help, I got my data back (had to reinstall osx because the disk utility couldn't repair the damages but i don't care) – tutzeroone Jun 4 '16 at 14:57

You must log in to answer this question.

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