Windows – How to repair damaged hybrid partition table from Windows

bootcamppartitionwindows

I am using a 2010 27" iMac with Mac OS High Sierra and Windows 10 via Bootcamp. Recently, I have had an issue where every Mac update renders the Windows partition unbootable. This means that after every Mac OS update, I need to use Gdisk to fix the hybrid partition table so I can boot Windows again. Unfortunately, this time after I did the repair the Mac partition will no longer boot. Is there a way of fixing the hybrid partition table from Windows so I can get the Mac Partition to boot again, it doesn't show up in the ALT menu on startup and if I try to boot using Refind, the boot process begins but doesn't complete with a crossed out circle on the screen.

When I open Fdisk and run list partition, I get the following:

DISKPART> LIST PARTITION

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary           1370 GB    512 B
  Partition 2    Primary             14 GB  1370 GB
  Partition 3    Primary            478 GB  1384 GB
  Partition 4    Primary             16 KB  1863 GB

The Mac OS is installed on Partition 1, Partition 3 is the Boot Camp one.
The Mac OS partition still doesn't show up, even if I try to reinstall High Sierra from a USB drive.

Running the commands suggested below gave the following results, sorry for including them as an image, I could not work out how to save them from the USB boot drive.
Screenshot

What is the procedure to try and restore the Mac Partition? I think I will need to use GDisk from the Boot Camp partition. I think I messed up the last time I used GDisk on the Mac to get Windows working again so I want to be careful this time! Windows is working so how can anyone help me use FDisk/GDisk on Windows to restore the partition table to a working state?

Best Answer

The usual request is for the OP to post the output from the commands gpt -r show /dev/disk0 and fdisk /dev/disk0. You can enter these commands while booted to macOS Recovery. Normally, you boot to macOS Recovery by turning on your Mac and immediately pressing and holding Command (⌘)-R key combination. Continue holding until you see the Apple logo. Startup is complete when you see an utilities window similar to what is shown below.

Once boot to macOS Recovery, you can select to open a Terminal window from the menu bar.

If you can not boot to macOS Recovery and can boot Windows, then you can download and use GPT fdisk to print the contents of the GPT and MBR partition tables. After downloading and extracting, you will need to enter the command gdisk64 \\.\PhysicalDrive0 from an "Administrator: Command Prompt" window. To print the tables, enter the following when prompted by gdisk64.

r
p
o
q

After posting the content of these tables to your question, I would hopefully be able to advise on the next step.

Update:

Here are instructions for using gdisk under Windows to fix the MBR partition table.

Start by entering the command gdisk64 \\.\PhysicalDrive0 in an "Administrator: Command Prompt" window. Here, I assume the current directory in the window contains the gdisk64.exe file downloaded from gptfdisk at SourceForge.

Below are the commands to enter in to gdisk.

R
H
2 7
Y
AF
N
07
Y
N
W
Y

Below is sample output. Note: Your output might vary slightly from what is shown below.

GPT fdisk (gdisk) version 1.0.4

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.

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 7
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 AF): AF
Set the bootable flag? (Y/N): N

Creating entry for GPT partition #7 (MBR partition #3)
Enter an MBR hex code (default 07): 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): 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 \\.\PhysicalDrive0.
Disk synchronization succeeded! The computer should now use the new
partition table.
The operation has completed successfully.

Note: If you get macOS to boot, but Windows fails to boot, then you will need to rebuild your Windows BCD file.