Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jul 2005 19:03:17 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Doug Poland <doug@polands.org>
Cc:        questions@freebsd.org
Subject:   Re: Lock down device name for USB drive
Message-ID:  <20050703000317.GP2392@dan.emsphone.com>
In-Reply-To: <20050702160424.GA67915@polands.org>
References:  <56241.209.103.198.74.1120249277.squirrel@email.polands.org> <20050701221803.GO2392@dan.emsphone.com> <20050702160424.GA67915@polands.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 02), Doug Poland said:
> On Fri, Jul 01, 2005 at 05:18:04PM -0500, Dan Nelson wrote:
> > In the last episode (Jul 01), Doug Poland said:
> > > I'm trying to use the automounter to mount a USB thumbdrive on
> > > -STABLE.  The only problem I'm having is that, between reboots, the
> > > name of the device changes between da0s1 and da1s1. Is there a
> > > way to lock down the device name so it doesn't change?
> > 
> > Depends on what you want to lock down.  If you only want a
> > particular thumbdrive to be mounted, you can give it a label and
> > use geom_label to provide a /dev/msdosfs/mylabel node.  If you
> > always want the first usb drive plugged in to be mounted, you can
> > wire down umass and the device to always appear at the same scbus#
> > and da# numbers, by adding something like this to loader.conf:
>
> Thanks for the info.  This particular box has an internal IDE Zip
> drive as well.  I noticed when I added device atapicam to the kernel,
> then the Zip drive shows up as /dev/da* .  That is complicating
> things as sometimes either the Zip drive or the USB drive may or may
> not be plugged in when the machine reboots.
> 
> I've read man loader.conf and man device hints and I'm a little fuzzy
> on how the hints work in loader.conf.
> 
> If I want the Zip drive to always be da0 (here's dmesg from a recent boot)
> Jul  2 10:29:45 couillard kernel: da0 at ata1 bus 0 target 1 lun 0
> 
> Then loader.conf should have:
> hint.ata1.0.at="ata1"
> hint.da.0.at="ata1"
> hint.da.0.target="1"
> hint.da.0.unit="0"

"da#" devices always attach to "scbus#" devices, which in turn attach
to "ata#" devices.  The extra layer is important so you can represent
all the busses of a multi-channel SCSI adapter.  "camcontrol devlist
-v" is the best way I've found to list what attaches to what.
 
> And I want the USB drive to be da1 (snip from dmesg again)
> Jul  2 10:30:26 couillard kernel: umass0: PNY USB DISK 20X, rev 2.00/1.00, addr 2
> Jul  2 10:30:27 couillard kernel: da1 at umass-sim0 bus 0 target 0 lun 0
> 
> And loader.conf should read:
> hint.scbus.0.at="umass0"
> hint.da.0.at="scbus0"
> hint.da.0.target="0"
> hint.da.0.unit="0"
> 
> Unfortunately, when I reboot, I get the Zip drive at da1 and the
> Thumbdrive at da2!  What am I doing wrong?  

First, you don't want two sets of da0 hints :)  This should work:

hint.scbus.0.at="ata1"
hint.da.0.at="scbus0"
hint.da.0.target="1"
hint.da.0.unit="0"
hint.scbus.1.at="umass0"
hint.da.1.at="scbus1"
hint.da.1.target="0"
hint.da.1.unit="0"
 

-- 
	Dan Nelson
	dnelson@allantgroup.com



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