Lock down device name for USB drive

Doug Poland doug at polands.org
Sat Jul 2 16:04:43 GMT 2005


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
Jul  2 10:29:45 couillard kernel: da0: <IOMEGA ZIP 100 14.A> Removable Direct Access SCSI-0 device
Jul  2 10:29:45 couillard kernel: da0: 3.300MB/s transfers
Jul  2 10:29:45 couillard kernel: da0: 96MB (196608 512 byte sectors: 64H 32S/T 96C)

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"

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
Jul  2 10:30:27 couillard kernel: da1: < USB DISK 20X PMAP> Removable Direct Access SCSI-0 device
Jul  2 10:30:27 couillard kernel: da1: 1.000MB/s transfers
Jul  2 10:30:27 couillard kernel: da1: 238MB (487424 512 byte sectors: 64H 32S/T 238C)

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?  

-- 
Regards,
Doug


More information about the freebsd-questions mailing list