Mac Mini running High Sierra.
Three partitions on the internal drive: macOS (HFS+ Journaled), Windows (Bootcamp) and a separate NTFS partition for Windows applications.
(I know there's multiple threads on similar topics but they all appeared to be old and I'm tired of being chastised for necrothreading.)
A while back I booted into my Windows 10 Bootcamp partition and allowed it to update things. I only boot to Windows about every month or so, so this can take a while. Once it was done it went to restart but failed to do so. It went into a repair mode, couldn't repair, couldn't recover from the last System Recovery point, nothing.
My son has started a budding business in IT and is far more Windows proficient than I so I asked him to take a look at it. He did and had no more success than I did. He ran a disk scan that found a number of bad sectors but this had no effect so he took it upon himself to delete the Windows partitions. It seems, however, that in doing so, whatever utility he was using told the entire drive it was all Windows partitions and I could no longer boot the device at all, neither to Windows or Mac.
He put Testdisk on a flash drive at my insistance and I've been able to tinker with it some on my own but with limited results. I was able to undelete the macOS Recovery partition so I could boot into Recovery mode though I've been doing most of my work through the net-based Recovery mode (I'll call this net-Recovery) as something I read suggested that would give me the most relevant set of tools for my version of the OS.
I used TeskDisk (and DiskUtil) to compile a map of my drive. If I can get the macOS portion running again, I'll probably remove the Bootcamp partition and rebuild it using the proper tools and reinstall Windows altogether, but I want to save the Mac portion if I can. From what I can tell from information on this and another site I should probably rebuild my partition map using "gpt" (I can't use "gdisk" since I don't have anyplace to install it that I'm aware of; I'm working on the internal drive). I've run into an issue getting Suspicious MBR at sector 0. Even trying to use "gpt -v destroy -r disk0" doesn't work because of this. I get the impression I can use "fdisk" to rebuild this? I think I'm just looking to make sure what I'm planning is right before I mess things up irrevocably.
When I run "diskutil disk0" under net-Recovery, I get this:
0: FDisk_partition_scheme 500.1GB disk0
1: 0xEE 209.7MB disk0s1
2: Apple_HFS 370GB disk0s2
4: Windows_NTFS 53.7GB disk0s4
Testdisk provided the following map:
EFI System 40 409639 409600
Mac HFS 409640 723065887 722656248
Mac HFS 723065888 724335423 1269536
MS Data 724336640 829194239 104857600
I'm pretty sure the 2nd Mac HFS is the Recovery partition. Why it isn't appearing on the DiskUtil list, I'm not sure, but it may have something to do with using net-Recovery? Anyway, what is listed above is what I'm trying to restore.
Running "gpt -v show /dev/disk0" provides:
mediasize=500107862016; sectorsize=512; blocks=976773168
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 GPTpart-C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 722656248 2 GPTpart-48465300-0000-11AA-AA11-00306543ECAC
723965888 1269536 3 GPTpart-48465300-0000-11AA-AA11-00306543ECAC
724335424 1216
724336640 104857600 4 GPTpart-EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
829194240 147578895
976733135 32 Sec GPT table
976773167 1 Sec GPT header
So I could not run "gpt create -f /dev/disk0" because "device already contains a GPT" and as I mentioned I could not destroy the gpt to rebuild it because of the suspicious MBR.
I believe what I want to do next is run
fdisk -i -a hfs /dev/disk0
I'm unsure whether I should use the hfs style or the ufs style, and can't find anything conclusive about why I would pick one over the other. Regardless, I've read that this should remove the previous MBR and the "suspicious" errors.
Then I should be able to rebuild the GPT:
gpt create -f /dev/disk0
And then rebuild the EFI table:
gpt add -b 40 -i 1 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0
And then rebuild the expected partitions:
gpt add -b 409640 -i 2 -s 722656248 -t 48465300-0000-11AA-AA11-00306543ECAC disk0
gpt add -b 723065888 -i 3 -s 1269536 -t 48465300-0000-11AA-AA11-00306543ECAC disk0
gpt add -b 724336640 -i 4 -s 104857600 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0
Am I on the right track?