From owner-freebsd-questions@FreeBSD.ORG Wed Dec 7 12:51:52 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 9A62D106566B for ; Wed, 7 Dec 2011 12:51:52 +0000 (UTC) (envelope-from jmc-freebsd2@milibyte.co.uk) Received: from avasout08.plus.net (avasout08.plus.net [212.159.14.20]) by mx1.freebsd.org (Postfix) with ESMTP id 03D1A8FC17 for ; Wed, 7 Dec 2011 12:51:51 +0000 (UTC) Received: from curlew.milibyte.co.uk ([84.92.153.232]) by avasout08 with smtp id 6Cro1i003516WCc01CrpzT; Wed, 07 Dec 2011 12:51:49 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=LMnkseq9 c=1 sm=1 a=lfSX4pPLp9EkufIcToJk/A==:17 a=rLpCYgkgFLgA:10 a=ZTb9aqGL9YkA:10 a=8nJEP1OIZ-IA:10 a=FbifnEMPkAUe2HGNYjIA:9 a=wPNLvfGTeEIA:10 a=UN-oJipazlnvzRoo:21 a=o2mhpN5Q6kzSG_sJ:21 a=lfSX4pPLp9EkufIcToJk/A==:117 Received: by curlew.milibyte.co.uk with local (Exim 4.77) (envelope-from ) id 1RYGyS-00016v-24; Wed, 07 Dec 2011 12:51:48 +0000 From: Mike Clarke To: freebsd-questions@freebsd.org Date: Wed, 7 Dec 2011 12:51:47 +0000 User-Agent: KMail/1.9.10 References: <201112051708.16072.jmc-freebsd2@milibyte.co.uk> <20111207044901.72ace69f@vixen42.vulpes.vvelox.net> In-Reply-To: <20111207044901.72ace69f@vixen42.vulpes.vvelox.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201112071251.47968.jmc-freebsd2@milibyte.co.uk> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: jmc-freebsd2@milibyte.co.uk X-SA-Exim-Scanned: No (on curlew.milibyte.co.uk); SAEximRunCond expanded to false Cc: "Zane C. B-H." 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 12:51:52 -0000 On Wednesday 07 December 2011, Zane C. B-H. wrote: > 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 Because devfs only relates to boot time and I want to deal with usb sticks inserted while the system is running. The allocation of device numbers is dynamic and depends on what other umass devices are already connected. Normally my internal memory card reader is allocated da[0-3] at boot time and the memory stick will appear as da4 when subsequently inserted but if it's already plugged in when the system boots then it appears as da0 and the card reader is da[1-4]. If I insert an extra memory stick it will be allocated the next available device number. I don't want the user to have to hunt around to determine which device to mount so my script takes the umass device number supplied by devd and determines the relevant da* device then it sets the permission to 660 for that device and creates a link, /dev/usbstick, pointing to it. All the user then has to do is mount /dev/usbstick on his mount point. Following the earlier tip from Polytropon I now have a working script which does exactly what I need. -- Mike Clarke