Fixing MBR with gptsync

All of a sudden my Windows 7 bootcamp harddrive couldn`t be started and I got a „No bootable device -- insert boot disk and press any key“. I tried to restore the partition map with testdisk as this helped me some time ago but I got no luck this time.

I installed Windows 10 on a new ssd via the boot camp assistant as a swap for the old bootcamp harrdive. Now I can access the partition but only when I use the boot manager on the startup screen (via alt- key). Otherwise, I still get the „no bootable device“ message or just a blinking cursor.

For additional information: I´m using a mac pro 4.1 with a normal pc grafics card, so I am not able to see the the boot screen. This combination worked for me for a long time now and I was switching systems with the Start Volume preference pane.


I looked up my problem and tried gptsync on my Macintosh drive (disk0). Now I just want to verify that this tool lists the correct MBR partition table and i can accept its suggestion to fix my booting problems.


$ sudo gptsync /dev/disk0


Current GPT partition table:

# Start LBA End LBA Type

1 40 409639 EFI System (FAT)

2 409640 487127591 Mac OS X HFS+

3 487127592 488397127 Mac OS X Boot


Current MBR partition table:

# A Start LBA End LBA Type

1 1 488397167 ee EFI Protective


Status: MBR table must be updated.


Proposed new MBR partition table:

# A Start LBA End LBA Type

1 1 409639 ee EFI Protective

2 409640 487127591 af Mac OS X HFS+

3 487127592 488397127 ab Mac OS X Boot

4 488397128 488397167 ee EFI Protective


May I update the MBR as printed above? [y/N]

gptsync on the bootcamp drive (disk1):

$ sudo gptsync /dev/disk1


Current GPT partition table:

# Start LBA End LBA Type

1 2048 34815 MS Reserved

2 34816 975794516 Basic Data

3 975796224 976771071 Unknown


Current MBR partition table:

# A Start LBA End LBA Type

1 1 4294967295 ee EFI Protective


Status: GPT partition of type 'Unknown' found, will not touch this disk.


Thank you!

Mac Pro, macOS Sierra (10.12.6)

Posted on Feb 6, 2018 2:49 PM

Reply

Similar questions

15 replies

Feb 6, 2018 3:41 PM in response to Loner T

$ sudo gpt -vv -r show /dev/disk1

Password:

gpt show: /dev/disk1: mediasize=500107862016; sectorsize=512; blocks=976773168

gpt show: /dev/disk1: PMBR at sector 0

gpt show: /dev/disk1: Pri GPT at sector 1

gpt show: /dev/disk1: Sec GPT at sector 976773167

start size index contents

0 1 PMBR

1 1 Pri GPT header

2 32 Pri GPT table

34 2014

2048 32768 1 GPT part - E3C9E316-0B5C-4DB8-817D-F92DF00215AE

34816 975759701 2 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

975794517 1707

975796224 974848 3 GPT part - DE94BBA4-06D1-4D40-A16A-BFD50179D6AC

976771072 2063

976773135 32 Sec GPT table

976773167 1 Sec GPT header



$ sudo fdisk /dev/disk1

Disk: /dev/disk1 geometry: 60801/255/63 [976773168 sectors]

Signature: 0xAA55

Starting Ending

#: id cyl hd sec - cyl hd sec [ start - size]

------------------------------------------------------------------------

1: EE 0 0 2 - 384 254 63 [ 1 - 4294967295] <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



$ diskutil list

/dev/disk0 (internal, physical):

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *250.1 GB disk0

1: EFI EFI 209.7 MB disk0s1

2: Apple_HFS Macintosh SSD 249.2 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3


/dev/disk1 (internal, physical):

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *500.1 GB disk1

1: Microsoft Reserved 16.8 MB disk1s1

2: Microsoft Basic Data BOOTCAMP 499.6 GB disk1s2

3: Windows Recovery 499.1 MB disk1s3

Feb 6, 2018 3:19 PM in response to Loner T

$ sudo gpt -r show /dev/disk0
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 486717952 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
487127592 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
488397128 7
488397135 32 Sec GPT table
488397167 1 Sec GPT header
$ sudo fdisk /dev/disk0
Disk: /dev/disk0 geometry: 30401/255/63 [488397168 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 488397167]
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

Feb 10, 2018 11:19 AM in response to cammatej

Leave the 4870 in the MP, remove the MBR, and test booting Windows. Do you still have the WinRE partition?


In most cases, the issue is the GPU Firmware which is incompatible with the EFI on the MP? Was macOS update/upgraded to High Sierra when these issues started? The HS EFI updates break previously working configurations, partly due to security fixes and updates.

Feb 9, 2018 4:01 PM in response to Loner T

Windows Recovery says it can´t do anything. Is it possible that i messed up the installation with the boot camp assistant on the ssd?


I assume i had to do the following steps with GPT FDisk:


  1. Sudo gdisk /dev/disk1
  2. P (Print list of parts)
  3. R (Recover)
  4. H (chooses Hybrid)
  5. O (print current Hybrid MBR)
  6. Partitions numbers to be hybridized: 2 3 4
  7. Y (Good for GRUB question)
  8. N (part 2 boot flag)
  9. N (part 3 boot flag)
  10. Y (part 4 boot flag make NTFS bootable partition)
  11. O (print current Hybrid MBR)
  12. W (Write the new MBR)
  13. Y (Yes! write the new MBR)
  14. Reboot

What would my partition numbers be?

Feb 10, 2018 10:13 AM in response to Loner T

I did the steps below but now I can`t boot windows anymore. I tried windows recovery and chkdsk. I do see the bootcamp partition in macOS.


$ sudo gdisk /dev/disk1

Password:

GPT fdisk (gdisk) version 1.0.3


Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

The protective MBR's 0xEE partition is oversized! Auto-repairing.


Partition table scan:

MBR: protective

BSD: not present

APM: not present

GPT: present


Found valid GPT with protective MBR; using GPT.


Command (? for help): p

Disk /dev/disk1: 976773168 sectors, 465.8 GiB

Sector size (logical): 512 bytes

Disk identifier (GUID): D40C269E-E4C0-4CB2-B655-29E3309F4BF8

Partition table holds up to 128 entries

Main partition table begins at sector 2 and ends at sector 33

First usable sector is 34, last usable sector is 976773134

Partitions will be aligned on 2048-sector boundaries

Total free space is 5784 sectors (2.8 MiB)


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

1 2048 34815 16.0 MiB 0C01 Microsoft reserved ...

2 34816 975794516 465.3 GiB 0700 Basic data partition

3 975796224 976771071 476.0 MiB 2700


Command (? for help): r


Recovery/transformation command (? for help): h


WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,

just hit the Enter key at the below prompt and your MBR partition table will

be untouched.


Type from one to three GPT partition numbers, separated by spaces, to be

added to the hybrid MBR, in sequence: 2

Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y


Creating entry for GPT partition #2 (MBR partition #2)

Enter an MBR hex code (default 07):

Set the bootable flag? (Y/N): y


Unused partition space(s) found. Use one to protect more partitions? (Y/N): n


Recovery/transformation command (? for help): o


Disk size is 976773168 sectors (465.8 GiB)

MBR disk identifier: 0x00000000

MBR partitions:


Number Boot Start Sector End Sector Status Code

1 1 34815 primary 0xEE

2 * 34816 975794516 primary 0x07


Recovery/transformation command (? for help): w


Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

PARTITIONS!!


Do you want to proceed? (Y/N): y

OK; writing new GUID partition table (GPT) to /dev/disk1.

Warning: Devices opened with shared lock will not have their

partition table automatically reloaded!

Warning: The kernel may continue to use old or deleted partitions.

You should reboot or remove the drive.

The operation has completed successfully.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Fixing MBR with gptsync

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.