Date: Thu, 5 Jan 2006 14:24:37 +1030 From: Malcolm Kay <malcolm.kay@internode.on.net> To: freebsd-questions@freebsd.org Cc: user <user@dhp.com> Subject: Re: how can I find out which md device I just used ? (mdconfig) Message-ID: <200601051424.38041.malcolm.kay@internode.on.net> In-Reply-To: <Pine.LNX.4.21.0601042216560.8684-100000@shell.dhp.com> References: <Pine.LNX.4.21.0601042216560.8684-100000@shell.dhp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601051424.38041.malcolm.kay>