From owner-freebsd-questions@FreeBSD.ORG Mon Dec 5 17:08:20 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 8645E106566C for ; Mon, 5 Dec 2011 17:08:20 +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 E06CF8FC08 for ; Mon, 5 Dec 2011 17:08:19 +0000 (UTC) Received: from curlew.milibyte.co.uk ([84.92.153.232]) by avasout08 with smtp id 5V8G1i004516WCc01V8H2N; Mon, 05 Dec 2011 17:08:17 +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=3PPtwt9Swo0DDw6oymwA:9 a=wPNLvfGTeEIA:10 a=lfSX4pPLp9EkufIcToJk/A==:117 Received: by curlew.milibyte.co.uk with local (Exim 4.77) (envelope-from ) id 1RXc1Y-0000qo-5v for freebsd-questions@freebsd.org; Mon, 05 Dec 2011 17:08:16 +0000 From: Mike Clarke To: freebsd-questions@freebsd.org Date: Mon, 5 Dec 2011 17:08:15 +0000 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201112051708.16072.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 Subject: 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: Mon, 05 Dec 2011 17:08:20 -0000 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? -- Mike Clarke