Reinstalling boot blocks on a ZFS-only system

Chris Ross cross+freebsd at distal.com
Mon May 13 02:20:29 UTC 2013


On May 12, 2013, at 16:58 , Jeremy Chadwick <jdc at koitsu.org> wrote:
> 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".

  In the past, I've found I've been unable to install all of the bootblocks if I
boot from the ZFS root.  When booting from a cd, the basic:

	gpart bootcode -p ${bootdir}/zfsboot ${disk}
	dd if=${bootdir}zfsloader of=/dev/${disk}a bs=512 oseek=1024 conv=notrunc,sync

works.  But, if I boot from ZFS, then I can't dd anything into the front of the 
drives.  Right now, the problem after booting from the CD, is trying to mount
a read/write filesystem (mfs, or the like) so that I can scp the bootblocks onto the
system and install them.  BUt, I eventually found the command I'd lost. so I 
think I'm alright.  Thanks...

            - Chris



More information about the freebsd-stable mailing list