MBR GPT Mismatch

I tried the following procedure by KDParker using gdisk but I found the MBR partition table shows 3 partitions and GPT partition table shows 4 partitions. So before I can correct the start and end sectors, I need help sorting out mismatch in partition numbers...can anyone help?

BTW, this got flagged to me while I was trying to upgrade to Yosemite on my MacBook Air. I have a BOOTCAMP Partition.


KDParker

KDParkerJun 10, 2015 6:58 PM(

in response to KDParker)

Found a solution that worked for me:


Yes. First, download gdisk (URL in the OP) and run the installer package. Then run gdisk from a terminal window and run the v (verify command). If verify indicates no problems, then you're good to go and can just type "q" to quit. However, if it shows something like this, then you have the problem:


sudo gdisk /dev/disk0

Command (? for help): v


Warning! Mismatched GPT and MBR partition! MBR partition 4, of type 0x07, has no corresponding GPT partition! You may continue, but this condition might cause data loss in the future!

Identified 1 problems!


Next, display the MBR partition table and make note of the start and end sectors for your BOOTCAMP partition. This should be partition 4 unless you've added additional partition(s), which is not officially supported by Boot Camp. It should show something like this:


Command (? for help): r

Recovery/transformation command (? for help): o


Disk size is 1953525168 sectors (931.5 GiB)

MBR disk identifier: 0x7C170CB2

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 409639 primary 0xEE

2 409640 975693095 primary 0xAF

3 975693096 976962631 primary 0xAB

4 * 976963584 1952806911 primary 0x07


Next, display the GPT partition table information. Compare the start and end sectors for partition 4 to the MBR partition 4 start and end sectors. Most likely the start sectors will match, but the end sectors will be different.


Recovery/transformation command (? for help): m

Command (? for help): p


Number Start (sector) End (sector) Size Code Name

1 40 409639 200.0 MiB EF00 EFI System Partition

2 409640 975693095 465.1 GiB AF00 Customer

3 975693096 976962631 619.9 MiB AB00 Recovery HD

4 976963584 1953523711 465.7 GiB 0700 BOOTCAMP


Next, delete the GPT partition 4. (Note: this does not delete the actual partition from disk. It only deletes gdisk's in-memory representation of the GPT).


Command (? for help): d

Partition number (1-4): 4


Now, create a new partition 4 using the start and end sector values from the MBR partition 4.


Command (? for help): n

Partition number (4-128, default 4): 4

First sector (34-1953525134, default = 976962632) or {+-}size{KMGTP}: 976963584

Last sector (976963584-1953525134, default = 1953525134) or {+-}size{KMGTP}:1952806911

Current type is 'Apple HFS/HFS+'

Hex code or GUID (L to show codes, Enter = AF00): 0700

Changed type of partition to 'Microsoft basic data'


Now, change the name of the new partition 4 to BOOTCAMP:


Command (? for help): c

Partition number (1-4): 4

Enter name: BOOTCAMP


Run the verify command. It should report no problems. If it still reports a problem, quit (q command) and start over.


Command (? for help): v


If everything checks out, write new partition table to disk and exit.


Command (? for help): w


Reboot and test your dual boot setup to verify all is working correctly.

Replies

The following is a version of what you posted that I updated:


Boot into Recovery Mode (cmd+R).

  1. Utilities menu > Terminal > Type:

    csrutil disable

  2. Reboot normally


First, download gdisk (sourceforge.net/projects/gptfdisk/files/gptfdisk/1.0.0/gdisk-binaries/gdisk-1.0.0.pkg/download) and run the installer package.

Then run gdisk from a terminal window and run the v (verify command).

  • sudo gdisk /dev/disk0
  • Command (? for help): v


Given what you've said, it'll probably say:


Warning! Mismatched GPT and MBR partition! MBR partition 4, of type 0x07, has no corresponding GPT partition! You may continue, but this condition might cause data loss in the future!

Identified 1 problems!


Next, display the MBR partition table and make note of the start and end sectors for your BOOTCAMP partition.


  • Command (? for help): r
  • Recovery/transformation command (? for help): o

This should be partition 4 unless you've added additional partition(s), which is not officially supported by Boot Camp. It should show something like this:


Disk size is 1953525168 sectors (931.5 GiB)

MBR disk identifier: 0x7C170CB2

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 409639 primary 0xEE

2 409640 975693095 primary 0xAF

3 975693096 976962631 primary 0xAB

4 * 976963584 1952806911 primary 0x07


Next, display the GPT partition table information:


  • Recovery/transformation command (? for help): m
  • Command (? for help): p


Number Start (sector) End (sector) Size Code Name

1 40 409639 200.0 MiB EF00 EFI System Partition

2 409640 975693095 465.1 GiB AF00 Customer

3 975693096 976962631 619.9 MiB AB00 Recovery HD

4 976963584 1953523711 465.7 GiB 0700 BOOTCAMP


Compare the start and end sectors for partition 4 to the MBR partition 4 start and end sectors. Most likely the start sectors will match, but the end sectors will be different.


Next, delete the GPT partition 4. (Note: this does not delete the actual partition from disk. It only deletes gdisk's in-memory representation of the GPT).


  • Command (? for help): d
  • Partition number (1-4): 4


Now, create a new partition 4 using the start and end sector values from the MBR partition 4:


  • Command (? for help): n
  • Partition number (4-128, default 4): 4
  • First sector (34-1953525134, default = 976962632) or {+-}size{KMGTP}: 976963584
  • Last sector (976963584-1953525134, default = 1953525134) or {+-}size{KMGTP}: 1952806911
  • Current type is 'Apple HFS/HFS+'
  • Hex code or GUID (L to show codes, Enter = AF00): 0700
  • Changed type of partition to 'Microsoft basic data'


Now, change the name of the new partition 4 to BOOTCAMP:


  • Command (? for help): c
  • Partition number (1-4): 4
  • Enter name: BOOTCAMP


Run the verify command. It should report no problems. If it still reports a problem, quit (q command) and start over.


Command (? for help): v


If everything checks out, write new partition table to disk and exit.


Command (? for help): w


Reboot and test your dual boot setup to verify all is working correctly.


Boot back into Recovery Mode (cmd+R).

  1. Utilities menu > Terminal > Type:

    csrutil enable

  2. Reboot normally


-Max.

And, to overcome the missing partition on the MBR, you'd need to run the following. Note that, while it should work to allow you to continue with the guide above, there's no guarantee that your Bootcamp partition will still boot (although, again, it should). Be aware that from your current system state many people have ended up having to reformat and start again. Anyway, onwards with the commands:


  • sudo gdisk /dev/disk0
  • r

    to go to the recovery & transformation menu

b

  • to create a new hybrid MBR


4

  • to add partion 4 to the MBR. This is probably the number that you need to enter given what you've said. However, stop and post back if you're not sure what you're doing.

y

  • only if you are asked “Place EFI GPT (0xEE) partition first in MBR (good for GRUB)?”


<press enter>

  • to accept the default MBR hex code of 07

y

  • to set the bootable flag

n

  • do not protect more partitions

o

  • to print (display) the MBR. You will see a message telling you it’s go time to actually write the partition. It will say “Disk size is …” and list two MBR partitions it will make. This is essentially a notification of what the new MBR will look like. Look at it and if it looks acceptable then hit w <enter> to write out the table:


w

  • Recovery/transformation command (write partition table to disk)


y

  • to confirm that you want to proceed.


It will recommend you reboot your Macbook. Do it and when it’s booting up hold the left ALT/option key like you always do to test to see if you can still boot up into Bootcamp.


Max.