View Issue Details

IDProjectCategoryView StatusLast Update
0003566CentOS-5mkinitrdpublic2009-04-18 20:51
Reporterabbot 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version5.3 
Target VersionFixed in Version 
Summary0003566: mkinitrd does not recognize partitionable md raid
DescriptionDescription of problem:
mkinitrd doesn't support partitionable raid arrays (/dev/md/dXXpYY). If the
root device is on such partition, it isn't recognized as RAID at all.

How reproducible:
Simply - create a partitionable raid array and set it as the / device.

Expected results:
The partition should be recognized as a RAID array, the /dev/md/dXX array
should be assembled&started on boot
Additional InformationPlease check this fedora bugreport: https://bugzilla.redhat.com/show_bug.cgi?id=471979 it has a preliminary patch for the problem.
TagsNo tags attached.

Activities

2009-04-17 12:35

 

mkinitrd-md_d0.patch (1,809 bytes)
--- 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
 
mkinitrd-md_d0.patch (1,809 bytes)
abbot

abbot

2009-04-17 12:35

reporter   ~0009187

I've uploaded a slightly modified patch for the CentOS version of mkinitrd.
prschaffner

prschaffner

2009-04-18 20:51

reporter   ~0009191

As CentOS strives to be "bug-for-bug" compatible with upstream, this will not make it into CentOS proper unless it comes from upstream. Would not hurt to add to the upstream report, or better yet find or file one against RHEL5, with a reference to this bug report in the External Bug field. Guess there is a possibility of having it in centosplus if there is enough demand and a maintainer.

Issue History

Date Modified Username Field Change
2009-04-16 19:58 abbot New Issue
2009-04-17 12:35 abbot File Added: mkinitrd-md_d0.patch
2009-04-17 12:35 abbot Note Added: 0009187
2009-04-18 20:51 prschaffner Note Added: 0009191