From owner-freebsd-questions@FreeBSD.ORG Wed Dec 7 10:49:07 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6A23106564A for ; Wed, 7 Dec 2011 10:49:07 +0000 (UTC) (envelope-from v.velox@vvelox.net) Received: from vulpes.vvelox.net (vulpes.vvelox.net [99.69.115.42]) by mx1.freebsd.org (Postfix) with ESMTP id AEE008FC0C for ; Wed, 7 Dec 2011 10:49:07 +0000 (UTC) Received: from vixen42.vulpes.vvelox.net (vixen42.vulpes.vvelox.net [192.168.15.2]) (Authenticated sender: kitsune) by vulpes.vvelox.net (Postfix) with ESMTPA id 0AE033F58B for ; Wed, 7 Dec 2011 04:49:11 -0600 (CST) Date: Wed, 7 Dec 2011 04:49:01 -0600 From: "Zane C. B-H." To: freebsd-questions@freebsd.org Message-ID: <20111207044901.72ace69f@vixen42.vulpes.vvelox.net> In-Reply-To: <201112051708.16072.jmc-freebsd2@milibyte.co.uk> References: <201112051708.16072.jmc-freebsd2@milibyte.co.uk> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: umass to /dev/da* mapping 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: Wed, 07 Dec 2011 10:49:08 -0000 On Mon, 5 Dec 2011 17:08:15 +0000 Mike Clarke wrote: > > I have a fairly simple perl script which is run by devd when I plug > in a USB memory stick. The script sets up some permissions and a > link to make life easy for a user to mount the memory stick. > > This normally works fine but there are problems if the memory stick > is already inserted before booting. > > Normally my internal 4 slot memory card reader is detected as > umass0 with devices da[0-3] and when the USB memory stick is > inserted it comes up as umass1 with device da4 and my script works > on that assumption. If the USB stick is present on booting then it > appears as da0 on umass0 and the card reader is da[1-4] on umass1 > so the script fails. > > Is there any convenient way for my script to determine which da* > devices correspond to the umass device name? Why are you using a custom Perl script for this instead of the built in tools for this? Below is how I have it setup on my system... In /etc/devfs.rules... [localrules=10] add path 'da*s*' mode 0660 group 5001 In /etc/rc.conf... devfs_system_ruleset="localrules" In /etc/sysctl.conf... vfs.usermount=1 And what group 5001 is... [kitsune@vixen42]/etc> getent group 5001 devDAaccess:*:5001:kitsune [kitsune@vixen42]/etc> Allows the group "devDAaccess" to access /dev/da*s* and mount it. For more reading on this, I suggest the following man files... devfs.rules(5) rc.conf(5) devfs(8)