Sunday, July 11, 2010

Find your RAID MD Device Name from a Member Device

So you've got a bajillion RAID arrays; that's okay, really.  Thing is, if you need to find its mdX device, it can get tricky.  vGrep taxing the eyes?  Mine too, and I haven't had much luck with an alternative.  I know there's one out there, but I have yet to trip over it.

Here's what I've started doing:
mdadm --detail --scan |\
awk '/'`mdadm -E /dev/sde3|awk '/UUID/{print $NF}'`'/{print $2}'

/dev/md6
 Substitute in your own values for /dev/sde3.

Labels: , , , , ,