1

I was trying to change the size of my bootcamp partition. Here's what happened (mistakes were made):

  • Shrunk the size of Mac HD in disk utility from 370G to 300G, this created unformatted free space of 70G.
  • In Paragon Hard Disk Manager, expanded the Bootcamp partition into the free space, expanded from 130G to 200G.
  • Mac OS Sierra still working fine, Win7 shows in available disks from option-boot but boots to Windows Boot Loader screen that says can't find Win7.
  • In Paragon Hard Disk Manager, repaired the partition boot record of Win7 partition. Windows now boots again fine. Should've stopped here.
  • In Paragon HDM, I think I selected repair master boot record of the HD. This immediately changed all HFS+ partitions to one big free space, including EFI and Recovery partition. Can't be undone but I'm still running in OS X. I have a time machine backup from 2 days ago. Not too worried yet.
  • Made TestDisk USB. Made Paragon Recovery Kit USB. Saved an image of the newly-resized non-working Windows partition to an external HD from Paragon HDM.
  • Reboot. Back to Windows Boot Loader error screen. Option-reboot. Mac HD not showing in list, only Windows partition, which boots to error screen.
  • Tried every partition-repair and boot record repair available on the USBs. Was able to undelete partitions and recover the Mac free space as one 300G HFS+ partition that I could boot into only on an option-boot, but lost the EFI and Recovery partitions. Hard Disk Manager shows a 209M free space at the beginning of the drive that is the lost EFI partition but when I try to recover the partition, it says there is not enough free space.
  • Tried everything twice and the USBs again and probably make things worse.
  • Hit breaking point and make Sierra USB. Wiped HD from disk utility and reinstalled Sierra, now I have working EFI & Recovery partitions again. Used migration assistant to bring OS X back up to current with working EFI and Recovery partitions.

That's where I'm at now. Diskutil list from recovery boot shows:diskutil list from Recovery

Now then... What is going on with all the disks? Why is HD on a virtual disk? Is it possible to restore a working Windows 7 from my backup? If not, how do I install Win7 in Sierra now that bootcamp assistant doesn't support it?

1 Answer 1

2

Short answer (but lots of work):

You should wipe your disk clean and restore everything from backups. If you don't have backups, plan to spend considerable time with a tool like PhotoRec recovering individual files -- although you might get lucky with a tool like TestDisk and recover an entire filesystem or two.

Long answer (but with some hope of less work):

Your problem almost certainly derives from an inadequate understanding of hybrid MBRs. An out-of-the-box Mac uses the GUID Partition Table (GPT), which is used on most modern computers. In order to support dual-booting with Windows (at least through version 7), Apple uses an illegal GPT variant known as a hybrid MBR. This is a Frankenstein's Monster mash-up of GPT with the older Master Boot Record (MBR) partitioning system. Under a hybrid MBR, the GPT is the "real" partition table, and up to three partitions are duplicated in the MBR table. The trouble is that you now have two partition tables, but most tools don't understand that both partition tables must be modified. If you use a tool that modifies just one partition table, the two partition tables may fall out of sync. This can result in any number of subtle and not-so-subtle problems, including boot failures and serious filesystem damage. Your description shows that you modified your partition tables multiple times with multiple tools, making it difficult to understand the history of changes or the disk's current state, so it's impossible to provide a simple procedure for recovering the disk.

As a general rule, OS X disk utilities will operate on the GPT side, whereas Windows tools will operate on the MBR side. This rule is not 100% reliable, though. You didn't specify in your description which OSes were used to run which partitioning tools; but I'm guessing that you meant OS X's Disk Utility and Paragon Hard Disk Manager in Windows. The former modifies the GPT side, and I don't recall offhand what it does with hybrid MBRs; and I have no idea what the latter's capabilities are when it sees a hybrid MBR, but given your problem, my guess is it acts like an MBR-only tool in this case. You reported enough enough back-and-forth changes that I can't claim to have kept track of what's been done, even if my assumptions are correct.

Repairing this type of problem is sometimes possible, but it requires a careful examination of both the GPT and MBR partition tables so as to compare the two and identify which partition(s) are currently valid. If you think you can do this, I recommend you create a fresh standard GPT (without a hybrid MBR) and use that to repair the filesystems and back up critical files. If you're successful in doing this, you can create a fresh hybrid MBR.

Precisely how you go about examining both partition tables depends on the tools you use. Note that many tools (especially GUI tools) are quite imprecise about details like partition start points. You need sector-level precision to determine whether the partitions you see on the two partition tables are equivalent. My own GPT fdisk (gdisk) can provide this information. It operates on GPT data by default; but if you type x followed by o, it shows the (hybrid or protective) MBR data. Other tools can provide the same data, but offhand I'm not sure how (or if) you can do this with the tools that come with either OS X or Windows.

Moving forward:

If possible, don't use a hybrid MBR. Unfortunately, a hybrid MBR is more-or-less required when dual-booting between OS X and Windows 7 (or earlier) on a Mac. You might consider using virtualization (VirtualBox, VMWare, etc.) rather than a dual boot, so as to avoid the hybrid MBR and its dangers. You could also upgrade to Windows 8 or 10; these versions can usually be installed on a Mac in EFI mode, which uses GPT with a protective MBR, bypassing the dangers of a hybrid MBR.

If you must use a hybrid MBR, understand it. If you need to resize partitions on a disk that uses a hybrid MBR, use GPT-aware tools! You should not use MBR-only tools on a hybrid MBR disk -- at least, not unless you understand what you're doing and why. If you use a GPT partitioning tool to resize partitions on a hybrid MBR disk, you may find you've wiped out the hybrid MBR. That's not so bad, though, because tools like GPT fdisk can easily create a fresh hybrid MBR.

3
  • As of now I've reinstalled OS X Sierra from scratch and restored from time machine, which seems to be working fine but "gpt -r -vv show disk0" shows suspicious MBR at sector 0. What should I do about that? Now I'm trying to recover my bootcamp partition from a backup image I made after resizing (non-booting) that I made with Paragon HDM (filetype .pfi) in OS X. Can I make that bootable again somehow? Commented Oct 31, 2016 at 19:16
  • Without seeing the output of the gpt command, I can't comment on it. I'm not familiar with Paragon's backup tools, so I can't comment on how to make a restored Paragon backup bootable, except to note that you'll probably have to re-create a hybrid MBR.
    – Rod Smith
    Commented Nov 1, 2016 at 13:51
  • The output is in a separate question here: [superuser.com/q/1140907/658512]. I can access the complete file record of the Windows .pfi backup using a virtual disk mounter. Commented Nov 1, 2016 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .