From owner-freebsd-questions@FreeBSD.ORG Thu Jun 16 16:11:08 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2DD5316A41C for ; Thu, 16 Jun 2005 16:11:08 +0000 (GMT) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr2.xs4all.nl (smtp-vbr2.xs4all.nl [194.109.24.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9B34343D49 for ; Thu, 16 Jun 2005 16:11:07 +0000 (GMT) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr2.xs4all.nl (8.13.3/8.13.3) with ESMTP id j5GGB5Ss047496; Thu, 16 Jun 2005 18:11:05 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id 5D671656A; Thu, 16 Jun 2005 18:11:05 +0200 (CEST) Date: Thu, 16 Jun 2005 18:11:05 +0200 From: Roland Smith To: freebsd-questions@freebsd.org Message-ID: <20050616161105.GA44491@slackbox.xs4all.nl> Mail-Followup-To: freebsd-questions@freebsd.org, dave References: <000501c571eb$5bfb5b60$0200a8c0@satellite> <44is0e9yeo.fsf@be-well.ilk.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <44is0e9yeo.fsf@be-well.ilk.org> User-Agent: Mutt/1.4.2.1i X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! X-Virus-Scanned: by XS4ALL Virus Scanner Cc: dave Subject: Re: usb2 external drive gets different designations X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2005 16:11:08 -0000 --+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" 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--