Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2010 08:38:11 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Peter Steele <psteele@maxiscale.com>
Subject:   Re: How can I force boot from alternate drive with boot.config?
Message-ID:  <201002100838.11381.jhb@freebsd.org>
In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3849F770@MBX03.exg5.exghost.com>
References:  <7B9397B189EB6E46A5EE7B4C8A4BB7CB383B2699@MBX03.exg5.exghost.com> <23F2E2B0457F4046AD8350DAFB86C41130D434E7@MBX03.exg5.exghost.com> <7B9397B189EB6E46A5EE7B4C8A4BB7CB3849F770@MBX03.exg5.exghost.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002100838.11381.jhb>