Date: Sun, 12 May 2013 20:28:38 -0700 From: Jeremy Chadwick <jdc@koitsu.org> To: Garrett Wollman <wollman@hergotha.csail.mit.edu> Cc: freebsd-stable@freebsd.org Subject: Re: Reinstalling boot blocks on a ZFS-only system Message-ID: <20130513032838.GA76253@icarus.home.lan> In-Reply-To: <201305130314.r4D3EKaJ016781@hergotha.csail.mit.edu> 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
On Sun, May 12, 2013 at 11:14:20PM -0400, Garrett Wollman wrote: > In article <20130512205837.GA69605@icarus.home.lan>, jdc@koitsu.org writes: > > >You may also need to set kern.geom.debugflags=0x10 to inhibit GEOM's > >"safety measure" / to permit writing to LBA 0; see GEOM(4) and search > >for the word "foot". > > If you have set up your partitioning properly (read: following the > clearly recommended best practice on the wiki), there should never, > ever be any reason to do this. (That is why it's called a DEBUG > flag.) ... I'm in full agreement with you, but the irony is that you refer to "the wiki", which I have intentionally ignored for years now because it's always wrong/always out of date/under scrutiny/do-not-care-to-debate. Case in point: https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot 5. Install the Protected MBR (pmbr) and gptzfsboot loader 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 https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror 5. Install the Protected MBR (pmbr) and gptzfsboot loader to both drives Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad0 Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad1 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 https://wiki.freebsd.org/RootOnZFS/ZFSBootPartition 10. Install ZFS boot ... Install the boot1 stage: Fixit# dd if=/mnt2/boot/zfsboot of=/dev/ad0s3 count=1 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 > The necessary and sufficient invocation is: > > # gpart bootcode -b /boot/pmbr -p /boot/gptzfsloader -i 1 [a]daX > > I have no idea how this works with MBR partitioning, but I would make > one suggestion in that regard: DON'T. Whatever makes you think you > want to do that, think harder and find another way. I believe for MBR you'd need to refer to the slice, not the disk, i.e. ada0s1 (NOT THE PARTITION ada0s1a). I found this out long ago when doing the classic "bsdlabel -B ada0" method of updating boot blocks only to find it bitch/complain and insist I use the slice. I haven't dared touch gpart for bootblock updates on any FreeBSD system I have access to, simply because the gpart syntax is long and could really screw you over if you make a typo. Plus, remembering which files to refer to in /boot is always spotty. "Uh, do I use -b here or -p... Uh, do I use /boot/mbr or /boot/pmbr... err...". /boot is such a mess these days. -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130513032838.GA76253>
