gpart rewrites pmbr in a way which breaks Win 7 EFI bootloader

Andrey V. Elsukov ae at FreeBSD.org
Thu Aug 9 14:20:30 UTC 2012


On 09.08.2012 16:11, Lawrence Stewart wrote:
>>> - Should gpart be writing 0x80 (active) in the protective MBR entry?
>>
>> AFAIK, this was added because some BIOS could not boot without it.
> 
> Makes sense if gpart is writing the pmbr out i.e. "gpart bootcode -b
> /boot/pmbr <geom>", but manipulating an existing pmbr for a GPT specific
> subcommand smells dodgy to me.

When you create GPT it already has PMBR, because it is part of GPT
metadata. gpart's `bootcode' subcommand writes *bootcode* to specific
area in the PMBR.

>>>   - Why is Windows EFI bootloader so sensitive to 0x80 in pmbr?
>>
>> This question you should ask to the Microsoft. :)
> 
> Perhaps I should rephrase my question as:
> 
> Is the MS bootloader's behaviour reasonable/unreasonable based on what
> people know of the relevant specs? My current guess why it behaves like
> this is that if it sees an MBR partition marked active, it simply
> assumes another OS is in charge and therefore bails out at the Windows
> EFI boot stage.

In the EFI system partition might be several boot loaders, and this MS
bootloader's behaviour seems strange to me.

> Can and should are two different things. I would argue it's a POLA
> violation at the very least to manipulate the pmbr when the user asked
> for something else. I certainly started my hunting expecting to find the
> GPT changing in some subtle way when FreeBSD wrote it out compared to
> what Windows writes.
> 
> We have a specific gpart command to put a pmbr in place so I think it's
> reasonable to expect other GPT specific commands not to fiddle with the
> pmbr.

Don't confuse bootcode in the PMBR and PMBR.

-- 
WBR, Andrey V. Elsukov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20120809/a0a611a3/signature.pgp


More information about the freebsd-fs mailing list