--- mkinitrd.dist 2009-04-17 16:44:56.000000000 +0400 +++ mkinitrd 2009-04-17 15:40:47.000000000 +0400 @@ -420,8 +420,8 @@ continue ;; *) handleddevices="$handleddevices $device" ;; esac - if [[ "$device" =~ "^md[0-9]+" ]]; then - vecho "Found RAID component $device" + if [[ "$device" =~ "^md([0-9]+|[_/])" ]]; then + vecho "Found RAID array $device" handleraid "$device" continue fi @@ -611,8 +611,15 @@ return 0 fi - levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat) - devs=$(gawk "/^$1[ ]*:/ { print gensub(\"\\\\[[0-9]*\\\\]\",\"\",\"g\",gensub(\"^md.*raid[0-9]*\",\"\",\"1\")) }" /proc/mdstat) + # get the name of the whole array (for partitionable arrays) + array=${1%p?*} + + # translate md/NN to mdNN and md/dNN to md_dNN + shortarray=${array/md\/d/md_d} + shortarray=${shortarray/md\//md} + + levels=$(awk "/^$shortarray[ ]*:/ { print\$4 }" /proc/mdstat) + devs=$(gawk "/^$shortarray[ ]*:/ { print gensub(\"\\\\[[0-9]*\\\\]\",\"\",\"g\",gensub(\"^md.*raid[0-9]*\",\"\",\"1\")) }" /proc/mdstat) for level in $levels ; do case $level in @@ -635,7 +642,7 @@ done findstoragedriver $devs if [ "$start" = 1 ]; then - raiddevices="$raiddevices $1" + raiddevices="$raiddevices $array" fi return $start } @@ -1703,9 +1710,13 @@ done if [ -n "$raiddevices" ]; then + inst /sbin/mdadm.static $MNTIMAGE/bin/mdadm + if [ -f /etc/mdadm.conf ]; then + inst /etc/mdadm.conf $MNTIMAGE/etc + fi for dev in $raiddevices; do cp -a /dev/${dev} $MNTIMAGE/dev - emit "raidautorun /dev/${dev}" + emit "mdadm -As --auto=yes --run /dev/${dev}" done fi