gpart rewrites pmbr in a way which breaks Win 7 EFI bootloader
lstewart at freebsd.org
Thu Aug 9 09:06:26 UTC 2012
I recently got a new HP Compaq Elite 8200 work desktop which has a
hybrid UEFI and regular BIOS arrangement. I want to dual-boot Win 7
64bit Enterprise via EFI and FreeBSD 9-STABLE via BIOS+gptzfsboot (until
such time as we gain EFI support of course) on the machine and ran into
I finally got around to analysing the issue in detail and wrote it up here:
The summary is that FreeBSD's gpart rewrites the protective MBR with
0x80 (active) in the single MBR partition table entry, which makes the
MS EFI bootloader unhappy and it will stop booting Win 7.
The gpart command I ran to trigger the behaviour was "gpart modify -i 5
-t freebsd-zfs <geom>", where partition 5 was already created in Win 7
and manually set using Win 7's diskpart utility to type freebsd-zfs i.e.
the gpart command should have been a NOP. Indeed, the GPT remains
unchanged, but the pmbr gets changed, which is what breaks Win 7 booting.
After identifying the cause of the problem and a workaround (please see
the README.txt at the above URL for full details and pre/post gpart
dumps of the MBR+GPT), I have the following questions:
- Should gpart be writing 0x80 (active) in the protective MBR entry?
- Why is Windows EFI bootloader so sensitive to 0x80 in pmbr?
- Should gpart be silently rewriting the protective MBR entry at all
when only asked to make changes to the GPT?
Thanks in advance for any insights and help.
More information about the freebsd-fs