Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 May 2013 23:54:45 -0400 (EDT)
From:      Garrett Wollman <wollman@hergotha.csail.mit.edu>
To:        jdc@koitsu.org
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Reinstalling boot blocks on a ZFS-only system
Message-ID:  <201305130354.r4D3sjUu017172@hergotha.csail.mit.edu>
In-Reply-To: <20130513032838.GA76253@icarus.home.lan>
References:  <A6940C2F-17B4-4ECF-85B6-BA8CB335486E@distal.com> <201305130314.r4D3EKaJ016781@hergotha.csail.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <20130513032838.GA76253@icarus.home.lan>, jdc@koitsu.org write:
>https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot
>
>5. Install the Protected MBR (pmbr) and gptzfsboot loader

Bug #1: "Protective", not "Protected".

>   Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad0
>
>   This may fail with an "operation not permitted" error message, since the
>   kernel likes to protect critical parts of the disk. If this happens for
>   you, run:
>
>   Fixit# sysctl kern.geom.debugflags=0x10

I suppose the bit that's missing here is:

	...and then file a bug report, with severity "serious" and
	priority "high", because this indicates that something is
	seriously broken in the kernel's implementation of GPT
	partitioning.

The only way this step can fail (absent bugs) is if something (other
than gpart) has either the whole-disk device or the partition 1 device
open in exclusive mode, which is a "can't happen" condition at this
stage in an installation.  (Well, it can happen if the disk you are in
the process of destroying has a still-mounted filesystem on it, which
is what the code is supposed to prevent!)

This little bit of cargo-culting used to be necessary for *MBR* and
*bsdlabel* partitioning, before the days of "gpart bootcode", to
update the boot0 and embedded partition-boot (boot1) blocks while the
filesystem was mounted, because the bsdlabel boot blocks are stored in
the first 64k of the root filesystem.  When using GPT, the boot blocks
are stored in the boot partition, which doesn't have a mountable
filesystem on it, so should never be open for write except when gpart
bootcode is doing the deed.

-GAWollman




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305130354.r4D3sjUu017172>