How can I force boot from alternate drive with boot.config?

John Baldwin jhb at freebsd.org
Thu Feb 11 13:57:25 UTC 2010


On Thursday 11 February 2010 2:05:12 am Julian Elischer wrote:
> John Baldwin wrote:
> 
> > I think the unit number is largely ignored now.  The kernel used to believe it 
> > for finding /, but the loader now reads /etc/fstab and sets a variable in kenv 
> > to tell the kernel where to find /.
> 
> One of the most annoying "improvements" for the decade from my 
> perspective..

You can't communicate anything non-trivial like using a gmirror or
software-RAID for / otherwise.  The boothowto structure is very limited
in the root device hinting it can provide.

> because if / is not going to be where the loader thinks / is (because
> that is a different F with a different /etc/fstab) then you need to
> do lots of fancy footwork to undo the damage.

Generally the fix for that is to boot to the right partition in the first
place so that the loader reads the right /etc/fstab.  You are already
using the wrong kernel and modules if you are reading the wrong /etc/fstab.

> Oh and it's not terribly well documented how to get around it.
> (that I've found)

Just set vfs.mountroot.from to the device you want to use for / in
loader.conf.  The loader doesn't set the variable if it is already set.

-- 
John Baldwin


More information about the freebsd-hackers mailing list