how can I determine the lowest not-in-use md device (for use with mdconfig) ?

user user at dhp.com
Wed Jan 4 16:59:54 PST 2006


The command:

mdconfig -l

will tell me what md devices are in use currently on the system.  I have a
situation where I want to automatically mount a vnode filesystem with an
md device ... and I won't know ahead of time which devices are in use ...

So ... can anyone think of an elegant way to find the lowest available md
device ?

Basically, I want to know how to take thie output:

# mdconfig -l
md4 md0
#

and find which md?, that is not in that list, is the lowest ...

I don't even have a very good guess as to how to do this ...

I am working this into a /bin/sh shell script.

thanks.



More information about the freebsd-questions mailing list