MacOS – Internal SSD Drive Partition Map Errors

bootdisk-utilitymacospartitionwindows

So far all good:

My MacBook Pro internal drive (APPLE SSD SM1024G) has been partitioned for a while with two bootable disks:

  • Macintosh HD (≈900GB) – Mac OSX Extended Journaled, FireVault Encrypted
  • Windows HD (≈100GB) – NTFS, No Encryption

Recently I decided to add one more small partition to install Ubuntu to teach myself some stuff I was interested in. I partitioned out another chunk of the Macintosh HD into:

  • Ubuntu HD (≈50GB) – ExFAT, No Encryption

All of the above was done through Disk Utility except for changing the Windows HD partition to NTFS when I was installing windows to the drive a year or two ago.

The problem:

I go to install Ubuntu on the partition (despite reading about problems with two file systems on the same drive) as I've done it before on older computers. I first converted the Ubuntu HD into the ext4 format using the Ubuntu installer utility, but then afterwards the install of the Ubuntu OS failed a couple times in a row, leaving me with what I believe was:

  • Macintosh HD (≈900GB) – Mac OSX Extended Journaled, FireVault Encrypted
  • Windows HD (≈100GB) – NTFS, No Encryption
  • Ubuntu HD (≈50GB)- Ext4, No Encryption

Just a note that I never actually checked that the formatting of the Ubuntu HD partition was successful so it is possible that it was still ExFAT

I restarted the computer back into OS X partition and went clear the partition again and try to install again over a FAT format. Brought up Disk Utility and attempted to remove the small Ubuntu partition and the process failed. I tried a couple more times to no avail and thought i should restart and format the partition back to ExFAT using the Ubuntu install utility. When I restarted the computer holding the "option" key none of my Boot Disks were there… just one disk named "Windows" which seems to be a small part of Ubuntu which leaves me just at a black screen where i can type some code for Ubuntu.

What have I tried?:

From what I can tell it seems like I have screwed up the partition map in one way or another. I have reset the PRAM/NVRAM, I have reset the SMC, and I then started the computer in recovery mode. In the recovery mode disk utility I was able to see and access both my Macintosh HD and Windows HD partitions. I have attempted First Aid on the Macintosh HD partition with a failed result. However when I ran First Aid on the entire APPLE SSD SM1024G drive the process was successful. It however mentions that "Problems were found with the partition map which might prevent booting" (this was my first sign that there were problems with the partition map).

I next attempted to choose the startup disk in the recovery OS, which it allowed me to select once or twice but then upon restart i would just get the black code screen for Ubuntu. Later attempts to select startup disk through Recovery OS came to give me an error mentioning "Building Boot Caches on the Boot helper partition Failed" (Further cluing me to partition map problems).

Furthermore I tried reinstall the OS on Macintosh HD which it would not allow me to do saying that "you cannot startup from this disk". What I have ended up doing just as a temporary fix to back up files and reach out for help here is: I used the Recovery tools to install OS X onto an external drive and boot from that drive which will in turn also be showing up in any terminal readouts I give to clarify my problems. The physical disk I am currently booting from has 2 partitions on it (the second one being the backup of my Windows HD partition:

  • OSX BOOTDISK (≈125GB) Mac OS Extended Journaled, No Encryption
  • WINDOW HD R (≈125GB) ExFAT, No Encryption

Notes

The External drive I am booting from has one of those CDs that appear whenever it is plugged in, that disk shows up as:

WD SmartWare (≈165MB)

The partition that was once Ubuntu HD now shows in Disk utility only as part of the APPLE SSD SM1024G partition pie chart as:

Untitled (≈50GB) OS X Journaled, No Encryption

What am I looking for?

I will pretty much take what i can get in terms of a fix once I have completed the new backup of all my data. I'm guessing that I could probably format the entire APPLE SSD SM1024G drive and reinstall OS X to start over, re-partitioning my drive and installing each OS again and then pulling over all my data from the backups I am making. However I came across a question for a similar issue on someone's external disk and it looked like it was resolved with some work through terminal and much less effort in terms of setting up my 2 partitions all over again from scratch.

Edit:

the Question i was referencing was: Question Link

Here is my terminal output for gpt -r show disk0:

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  1664104984      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  1664514624     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1665784160    96124576      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1761908736      262144         
  1762170880   192038912      5  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1954209792         295         
  1954210087          32         Sec GPT table
  1954210119           1         Sec GPT header

Edit 2

sudo diskutil verifydisk disk0
...
Storage system check exit code is 0
Problems were found with the partition map which might prevent booting
Error: -69846: Unrecognized file system

Verifying disk still shows partition problems, please advise?
I can confirm it has been switched to PMBR, but the drives still do not show up.

Edit 3

After trying the method described in my only answer i have not resolved the issue. After the method of removing the MBR and recreating the GUID partition table the system is left with PMBR but the same issue of not being able to boot from any of the partitions on my internal SSD Drive.

Disk0 now appears as:

AdminisatorsMBP:~ administrator$ sudo gpt -r show disk0
Password:
       start        size  index  contents
           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  1664104984      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  1664514624     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1665784160    96386720         
  1762170880   192038912      4  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1954209792         295         
  1954210087          32         Sec GPT table
  1954210119           1         Sec GPT header

Please note that i have cleared the ≈50GB partition into free space using terminal so there is no longer a 5th partition showing up

Any further answers would be greatly appreciated

Best Answer

The boot sector of your SSD is slightly corrupted. It contains an MBR instead of an pMBR. After removing the bogus MBR you have to destroy and recreate the GUID partition table:

  • Boot to Internet Recovery Mode or an external boot drive. If you use an admin account booted to the external drive you have to prepend sudo to execute particular commands like gpt ....
  • Open Terminal in the menubar Utilities -> Terminal
  • Get an overview (especially the gpt command is important!):

    diskutil list
    gpt -r show disk0
    
  • Unmount disk0 (assuming disk0 is your SSD):

    diskutil umountDisk /dev/disk0
    
  • Delete the MBR:

    dd if=/dev/zero of=/dev/disk0 bs=512 count=1
    
  • Destroy the GUID partition table and create a new one (this also creates a fresh pMBR):

    diskutil umountDisk /dev/disk0
    gpt destroy disk0
    gpt create -f disk0
    
  • Rebuild all previous GUID partitions:

    gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0
    gpt add -i 3 -b 1664514624 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0
    gpt add -i 4 -b 1665784160 -s 96124576 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0
    gpt add -i 5 -b 1762170880 -s 192038912 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0
    gpt add -i 2 -b 409640 -s 1664104984 -t 53746F72-6167-11AA-AA11-00306543ECAC disk0
    

    If you get a resource busy error after one of the steps, just unmount disk0 again with

    diskutil umountDisk /dev/disk0
    

Check the disk with diskutil verifyDisk disk0 afterwards.


Recreating the pMBR may render your Windows and Linux partitions unbootable

Related Question