How can I force boot from alternate drive with boot.config?
John Baldwin
jhb at freebsd.org
Wed Feb 10 13:54:03 UTC 2010
On Tuesday 09 February 2010 2:22:53 pm Peter Steele wrote:
> >>> So, more precisely, if I wanted to boot from drive 1, I'd use this?
> >>>
> >>> 1:ad(1p3)/boot/loader
> >>
> >>Yes, unless there are more bugs hiding. :-) I fixed a few in August last
year.
> >
> >Well, I'll give it a try and let you know if I find new bugs... :-)
>
> I just tried this and it works as advertised--thanks. One question though:
Why does this string list the device number twice? The man page describes it
as
>
> bios_drive:interface(unit,[slice,]part)filename
>
> where bios_drive is the "drive number as recognized by the BIOS. 0 for the
first drive, 1 for the second drive, etc.", and unit is the "unit number of
the drive on the interface being used. 0 for the first drive, 1 for the second
drive, etc."
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 /.
> This sounds like it's describing the same thing, but not exactly, but I've
always used the same value in both fields and it's always worked. Is there a
case where these values might be different? In the test I just did I booted
from the fourth drive of a four drive system using
The BIOS drive number is based on however the BIOS works, and the code "knows"
that "ad" and "da" are hard drives, so it adds 0x80 to the BIOS drive number
to obtain the real BIOS drive number, but for "fd" it just uses the drive
number as-is.
> 3:ad(3p4)/boot/loader
>
> I know my hardware and knew ad10 mapped to the fourth drive and would be
referenced as drive 3 in this context. But how would I determine this
generically? For example, given something like /dev/adN, how do I know what
number I'd use for this drive in boot.config?
It's not generically mappable really. It depends on any option ROMs you may
have among other things. Typically if all you have is ATA device (adX), then
the lowest numbered adX device would be 0, the next adX device would be 1,
etc. However, if you have drives attached to multiple storage controllers
then it depends on the order the controllers register their option ROMs with
the BIOS.
--
John Baldwin
More information about the freebsd-hackers
mailing list