Reinstalling boot blocks on a ZFS-only system

Larry Rosenman ler at lerctr.org
Mon May 13 00:09:16 UTC 2013


On 2013-05-12 15:58, Jeremy Chadwick wrote:
> On Sun, May 12, 2013 at 04:50:46PM -0400, Chris Ross wrote:
> 
> So, I've long known and it makes sense that when you're booted from a 
> ZFS volume, you can't mess with the boot-loader.  And, I know a few 
> months ago I had a set of commands I would use when booted from a CD 
> that would initialize the network and copy the "release/boot" from 
> somewhere else so that I could install bootblocks and boot-loaders from 
> more recent code.  Sadly, I didn't _record_ those commands I was using.
> 
> What do "people in the know" do when they want to update the bootblocks 
> of a ZFS-boot system?  Or, have too few people followed this path so 
> far that they can boot UFS and do it with less difficulty?
> 
> The command is "gpart bootcode", however I cannot be bothered to
> remember the syntax; I imagine it greatly depends on if you're using 
> GPT
> vs. MBR, in addition to what your partition layout look like.  Meaning:
> there is no "universal standard", it depends entirely on how you set
> your stuff up.  But the command is definitely "gpart bootcode".
> 
> Next, AFAIK there is no need to boot alternate media (CD etc.) to
> accomplish this.
> 
> 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".
Assuming a freebsd-boot type partition, and GPT type partition scheme, 
this is what I
use on my ZFS boot system:

$ cat bin/update_boot.sh
#!/bin/sh
for i in `seq 0 5`
do
echo Disk ${i}
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada${i}
done
$

-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 214-642-9640 (c)     E-Mail: ler at lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893


More information about the freebsd-stable mailing list