Date: Thu, 16 Jun 2005 18:11:05 +0200 From: Roland Smith <rsmith@xs4all.nl> To: freebsd-questions@freebsd.org Cc: dave <dmehler26@woh.rr.com> Subject: Re: usb2 external drive gets different designations Message-ID: <20050616161105.GA44491@slackbox.xs4all.nl> In-Reply-To: <44is0e9yeo.fsf@be-well.ilk.org> References: <000501c571eb$5bfb5b60$0200a8c0@satellite> <44is0e9yeo.fsf@be-well.ilk.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 16, 2005 at 10:19:59AM -0400, Lowell Gilbert wrote: > "dave" <dmehler26@woh.rr.com> writes: >=20 > > I've got a working usb2 external IDE hard drive running on a 5.4-st= able > > box. My problem is sometimes when i connect it it is given a designatio= n 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? >=20 > 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 a label. With a USB thumbdrive I gave the command=20 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.=20 > Or, alternatively, to make a symbolic > link from a constant name in /dev (which is pretty close to what you > asked for originally). >=20 > Be well. --=20 R.F.Smith (http://www.xs4all.nl/~rsmith/) Please send e-mail as plain text. public key: http://www.xs4all.nl/~rsmith/pubkey.txt --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCsaSZEnfvsMMhpyURAuxXAJ0WQf83ws6/TUKOi9BoZpUufc7RKwCePfk9 7bC2BAIio+K06tlxM6ZBUjw= =JiDz -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050616161105.GA44491>