#!/bin/bash

mdadm_detail()
{
    while read md
    do
        /sbin/mdadm --detail /dev/${md}
    done
}

mdstat_list()
{
    awk -F' ' '/^md/ { print $1 }' /proc/mdstat
}

mdstat_list | mdadm_detail
