#481 Issue closed: grub failed with wrong mdadm metadata version

Labels: bug

tbsky opened issue at 2014-10-17 15:39:

hi:
rhel6 use legacy grub and can not boot madam metadata 1.2 with software raid 1.but "rear recover" use mdadm default to create software raid1 (which is metadata 1.2). grub can not install under this situation.

patch below. sorry I will try to use pull requests next time. it seems a little overskilled for a small patch.

--- 21_raid_layout.sh.orig      2012-03-30 16:37:30.000000000 +0800
+++ 21_raid_layout.sh   2014-10-17 20:37:49.727538398 +0800
@@ -18,6 +18,7 @@
             mdadm --misc --detail $device > $TMP_DIR/mdraid

             # Gather information
+            metadata=$( grep "Version" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2")
             level=$( grep "Raid Level" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2")
             uuid=$( grep "UUID" $TMP_DIR/mdraid | tr -d " " | cut -d "(" -f "1" | cut -d ":" -f "2-")
             layout=$( grep "Layout" $TMP_DIR/mdraid | tr -d " " | cut -d ":" -f "2")
@@ -56,6 +57,7 @@
             done

             # prepare for output
+            metadata=" metadata=$metadata"
             level=" level=$level"
             ndevices=" raid-devices=$ndevices"
             uuid=" uuid=$uuid"
@@ -84,7 +86,7 @@
                 name=""
             fi

-            echo "raid ${device}${level}${ndevices}${uuid}${name}${sparedevices}${layout}${chunksize}${devices}"
+            echo "raid ${device}${metadata}${level}${ndevices}${uuid}${name}${sparedevices}${layout}${chunksize}${devices}"

             extract_partitions "$device"
         done < <(mdadm --detail --scan --config=partitions)

gdha commented at 2014-10-21 11:40:

@tbsky can you make a pull request for this?

tbsky commented at 2014-10-21 17:26:

hi gdha:
ok I will make pull request for all the patches. please give me a few days. I think I can learn how to do it this weekend.

tbsky commented at 2014-10-24 10:55:

hi gdha:
pull request made. hope I did it correctly.

gdha commented at 2014-10-30 15:11:

is the fix working with the master git repo?

tbsky commented at 2014-10-30 16:08:

hi:
yes the fix is working. I guest I should press "close and comment" to finish the issue?


[Export of Github issue for rear/rear.]