usb2 external drive gets different designations
rsmith at xs4all.nl
Thu Jun 16 16:11:08 GMT 2005
On Thu, Jun 16, 2005 at 10:19:59AM -0400, Lowell Gilbert wrote:
> "dave" <dmehler26 at woh.rr.com> writes:
> > I've got a working usb2 external IDE hard drive running on a 5.4-stable
> > box. My problem is sometimes when i connect it it is given a designation of
> > da0 while other times it is given a designation of da1 or da2. I'd like to
> > create a fstab entry for this drive so that when it is connected it is
> > mounted and when disconnected it is unmounted cleanly. I was wondering if
> > this was possible or if not if there was a way of giving it da0 or da1
> > everytime the drive was connected?
> That's possible, but I can't find the way to do it right now.
I think the GEOM label class could be of help here, see glabel(8). The
strange thing is that the manual page for glabel says at the top that it
cannot set the label, but later it gives the "label" option for creating
With a USB thumbdrive I gave the command
glabel label hsteno64 /dev/da0s4
Next time I plugged it in, there was a device /dev/label/hsteno64.
With this done, you can use devfs.rules to set the permissions for this
node, e.g. 'add path label/hsteno64 mode 0660 user rsmith'
After that you can mount the device with amd(8).
> You may find it easier to set up usbd.conf(5) to automatically mount
> the device when it's detected.
The thing is that usbd only sees the umass* device, not the da*s*
device. You could make a script that looks through /var/log/messages for
lines that link the umass device to the da device, line this:
Jun 12 22:55:57 slackbox kernel: da0 at umass-sim0 bus 0 target 0 lun 0
When you see this you know that the event for umass0 has resulted in a
da0 device. A simple 'ls /dev/da0s?' should give you the slice (if there
is only one.
> Or, alternatively, to make a symbolic
> link from a constant name in /dev (which is pretty close to what you
> asked for originally).
> Be well.
R.F.Smith (http://www.xs4all.nl/~rsmith/) Please send e-mail as plain text.
public key: http://www.xs4all.nl/~rsmith/pubkey.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050616/abfdec85/attachment.bin
More information about the freebsd-questions