From owner-freebsd-questions@FreeBSD.ORG Thu Jan 5 03:54:49 2006 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 1C24116A41F for ; Thu, 5 Jan 2006 03:54:49 +0000 (GMT) (envelope-from malcolm.kay@internode.on.net) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FA0143D49 for ; Thu, 5 Jan 2006 03:54:48 +0000 (GMT) (envelope-from malcolm.kay@internode.on.net) Received: from alpha.home (ppp224-76.lns2.adl4.internode.on.net [203.122.224.76]) by ash25e.internode.on.net (8.13.5/8.12.6) with ESMTP id k053shmo030069; Thu, 5 Jan 2006 14:24:44 +1030 (CST) (envelope-from malcolm.kay@internode.on.net) From: Malcolm Kay Organization: at home To: freebsd-questions@freebsd.org Date: Thu, 5 Jan 2006 14:24:37 +1030 User-Agent: KMail/1.8 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200601051424.38041.malcolm.kay@internode.on.net> Cc: user Subject: Re: how can I find out which md device I just used ? (mdconfig) 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, 05 Jan 2006 03:54:49 -0000 On Thu, 5 Jan 2006 01:50 pm, user wrote: > mdconfig will use the next available md device, as long as you > do not specify a particular device on the command line with > the -u switch. > > Which is great. > > However, in a script, the very next thing I want to do is > mount that mdconfig'd vnode filesystem. But I do not know > which md device mdconfig just used. > > I do not see any way in the mdconfig man page to get mdconfig > to output what device it is using when it is invoked ... > > So ... assuming I am running mdconfig, followed by mount, in a > shell script ... and I do not specify a device becuase i do > not know what devices are available (beacuse I am running it > automated) ... how can I find out (any suggestions > appreciated) what md device just got used so I can mount it ? > > I consiudered running `mdconfig -l` before and after the > mdconfig, and choosing the one that shows up as new, but that > is not elegant and is vulnerable to a race condition. > On my system (5.4) mdconfig reports the created device to stdout: So: memdevice=`mdconfig -a -t malloc -s10M` sets the device name in $memdevice. Malcolm Kay