I have a Macbook Pro with retina, Yosemite and 500GB hard drive.
I tried to install Windows using Bootcamp and accidentally deleted a partition, now my Mac cannot boot anymore.
This is the output from sudo gpt -r show disk0
gpt show: 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 776617328 2 GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
777026968 1269760 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
778296728 616
778297344 198807552 4 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
977104896 131
977105027 32 Sec GPT table
977105059 1 Sec GPT header
I only need to make the second partition at index 2 and type FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
to be bootable again. This partition has FileVault 2 enabled.
But right now, I have no clue on what to do.
P/S: I Followed the instruction from @klanomath Boot from a external hard drive with full Yosemite system but at the last command to change the partition type
sudo gpt add -b 409640 -s 776617328 -i 2 -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
It got this error:
gpt add: /dev/disk0: Suspicious MBR at sector 0
gpt add: /dev/disk0: error: no space available on device
This is the output from sudo 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 776617328 2 MBR part 218
777026968 1269760 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
778296728 616
778297344 198807552 4 MBR part 175
977104896 131
977105027 32 Sec GPT table
977105059 1 Sec GPT header
Progress:
I have executed command sudo gpt destroy /dev/disk0
But when I tried to add the first partition back using this command sudo gpt add -b 40 -s 409600 -i 1 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
I got this error straight away
gpt add: /dev/disk0: Suspicious MBR at sector 0
gpt add: /dev/disk0: error: no primary GPT header; run create or recover
Now the command sudo gpt -r show /dev/disk0
gives me this
gpt show: /dev/disk0: Suspicious MBR at sector 0
start size index contents
0 1 MBR
1 409639
409640 776617328 2 MBR part 218
777026968 1269760 3 MBR part 175
778296728 616
778297344 198807552 4 MBR part 175
977104896 164
Progress 2:
I executed sudo gpt create /dev/disk0
and got this error:
gpt create: /dev/disk0: Suspicious MBR at sector 0
gpt create: /dev/disk0: error: device contains a MBR
and I executed this command sudo fdisk -i -a hfs /dev/disk0
to write new MBR
and executed sudo gpt create /dev/disk0
again but got the same error gpt create: /dev/disk0: error: device contains a MBR
Now sudo gpt -r show /dev/disk0
gives me this
start size index contents
0 1 MBR
1 62
63 977104997 1 MBR part 175
Progress 3 and final :D
Firstly a big thank to @klanomath, without the help, I couldn't go this far.
I executed this command sudo gpt create -fp /dev/disk0
And this command sudo gpt recover /dev/disk0
to get the secondary GPT header
After that, I executed sudo gdisk /dev/disk0
and the disk is mounted and functions properly
sudo gdisk /dev/disk0
, which is an interactive command. You have failed to specify the commands you entered intogdisk
. Also, since your partition problems can be fixed by just entering commands intogdisk
, then all the commands you posted before enteringsudo gdisk /dev/disk0
were unnecessary and did not need to be entered. – David Anderson Apr 21 '22 at 18:58