2

First off my problem is incredibly similar to this thread where the answer was almost reached but wasn't fully finished. Accidently deleted some small sized partitions when installing WIndows(Bootcamp). OSX Partition wont boot

I did the same thing, when I went to install Windows I saw four partitions two large ones: OSX and Bootcamp and two small ones which I thought I accidentally created. Unwittingly I deleted the two smaller ones via the windows installer, I now believe they were the recovery and EFI partitions. Anyhow when I went to reboot holding the option key there is nothing bootable that shows up, just a blank grey screen.

I did the cmd+opt+R and tried to reinstall OS X in place but the OS X partition isn't mountable. I also ran some things in Terminal to give a better idea of what's going on.

I have very important files I need to get to so reinstalling isn't really an option, I need to fix this and make it bootable or need to do data recovery. Any input is very welcome! Next time will use Time Machine....

diskutility diskutility2

  • By the way, what is the model/year of your Mac? What version of Windows did you install? The reason I ask is because both klanomath's and my answers fix the partition tables to allow OS X to boot. Whether Windows will boot depends on the your answers to my questions. – David Anderson Sep 7 '16 at 19:43
  • It is a mid 2011 MacBook air, I was reinstalling windows 10 after I found the Bluetooth wasn't functioning after 6 months of use. I did create a winclone image before attempting the reinstall so it doesn't matter if windows works or not right now. Thanks very much for the answers! I will try them once I create an image of the disk as it is in case I mess something up. I should be able to create a backup image of the broken OSX via disk utility correct? And if I mess up I can restore it to its current broken state? – Bryanb Sep 7 '16 at 21:02
  • Either answer should fix the partition tables enough to allow OS X to boot. My approach is to try and fix what I can see is wrong. Klamath's answer if more comprehensive since all partition table values are replaced. Once you boot to OS X, you will probably have to erase the Windows partition using the Disk Utility application. When doing so, you should choose the MS-DOS (FAT) format. Winclone will change the format back to NTFS. If you reinstall Windows, you will have to format the partition NTFS during the installation process. – David Anderson Sep 7 '16 at 21:45
  • If the OS X partition is not damaged, I suppose the Disk Utility could be used to backup the partition. You could try verifying the partition before attempting a backup. If you mess up, I doubt you will be able to restore to the current broken state. As far as I can see, the partition table values are messed up. I have no way of knowing if the data stored in the partitions is corrupted. – David Anderson Sep 7 '16 at 21:50
  • Well everything has worked out great so far and I am able to boot OSX with all of my data in tact. I want to say thank you very much! Your help is greatly appreciated and I can't thank you enough! – Bryanb Sep 8 '16 at 6:49
1

Your GUID Partition Table (GPT) look OK. You MBR table appears to have the wrong values. You can correct this by entering the following commands in a Terminal application window. I assume you will be doing this while booted using OS X Internet Recovery.

INPUT=$(printf  "e  1\nee\n\n1\n\nq\ny")
diskutil  unmountdisk  /dev/disk0
fdisk  -e  /dev/disk0  <<<"$INPUT"  &>/dev/null

This will restore your MBR to a Protected MBR (PMBR) which is required for GPT partitioned drives. When finished the command fdisk /dev/disk0 should produce the following output.

Disk: /dev/disk0    geometry: 14751/255/63 [236978176 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 -  236978175] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
1

You didn't delete any partition. Instead the MBR got bogus by using Windows' Disk Management tool.

Instead of the MBR you should have a pMBR. After removing the bogus MBR you have to destroy and recreate the GUID partition table:

  • Boot to Internet Recovery Mode
  • Open Terminal in the menubar Utilities -> Terminal
  • Get an overview (especially the gpt command is important!):

    diskutil list
    gpt -r show disk0
    
  • Unmount disk0:

    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:

    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 2 -b 409640 -s 166939584 -t 53746F72-6167-11AA-AA11-00306543ECAC disk0
    gpt add -i 3 -b 167349224 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0
    gpt add -i 4 -b 168620032 -s 68356096 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0
    

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

    diskutil umountDisk /dev/disk0
    

Depending on your Mac model this will render your Windows installation unbootable. Check one of David Anderson answers how to restore a proper MBR entry to boot Windows if you have a MBR-bootable Mac (in contrary to GUID-bootable Macs since ~2013).

  • Thank you very much for the input and fast response, I really appreciate it:) – Bryanb Sep 8 '16 at 6:49
  • @Bryanb Both answers lead to the same result, David's answer is more elegant and less work ;-) – klanomath Sep 8 '16 at 6:55

You must log in to answer this question.

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