Make Intel BIOS raid use mdraid instead of dmraid when mdadm 3.0 is available
authorHans de Goede <hdegoede@redhat.com>
Tue, 14 Jul 2009 20:24:42 +0000 (22:24 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 15 Jul 2009 16:27:20 +0000 (18:27 +0200)
Intel BIOS raid is being shifted from dmraid to mdraid because mdraid offers
more features. So if an imsm metadata capable mdadm is present use mdraid
instead of dmraid for isw_raid_member's

This patch also adds code to mdraid_start.sh so that the raidsets
inside the imsm containers get started once udev is done probing
(doing this earlier leads to potentially degraded use of the sets and
 an unwanted resync).

modules.d/90dmraid/61-dmraid-imsm.rules [new file with mode: 0644]
modules.d/90dmraid/install
modules.d/90mdraid/65-md-incremental-imsm.rules [new file with mode: 0644]
modules.d/90mdraid/install
modules.d/90mdraid/mdraid_start.sh

diff --git a/modules.d/90dmraid/61-dmraid-imsm.rules b/modules.d/90dmraid/61-dmraid-imsm.rules
new file mode 100644 (file)
index 0000000..e06ea3f
--- /dev/null
@@ -0,0 +1,15 @@
+# This file causes block devices with Linux RAID (mdadm) signatures to
+# automatically cause mdadm to be run.
+# See udev(8) for syntax
+
+SUBSYSTEM!="block", GOTO="dm_end"
+ACTION!="add|change", GOTO="dm_end"
+
+ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
+ENV{ID_FS_TYPE}=="isw_raid_member", GOTO="dm_end"
+
+ENV{ID_FS_TYPE}=="*_raid_member", \
+    TEST!="/tmp/.dmraid_scan-%k", \
+    RUN+="/bin/sh -c '>/tmp/.dmraid_scan-%k; /bin/ln -fs /sbin/dmraid_scan /initqueue/dmraid_scan.sh'"
+
+LABEL="dm_end"
index fadaf0f3ed9467071381fd4b8c43841e6ec0a997..d8aca57b75fcb047c9f03f525f311af00a97c84c 100755 (executable)
@@ -2,4 +2,8 @@
 dracut_install dmraid
 inst "$moddir/dmraid.sh" /sbin/dmraid_scan
 inst_rules 64-md-raid.rules
-inst_rules "$moddir/61-dmraid.rules"
+if [ ! -x /lib/udev/vol_id ] && mdadm -Q -e imsm /dev/null &> /dev/null; then
+    inst_rules "$moddir/61-dmraid-imsm.rules"
+else
+    inst_rules "$moddir/61-dmraid.rules"
+fi
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
new file mode 100644 (file)
index 0000000..7dcdf33
--- /dev/null
@@ -0,0 +1,10 @@
+# This file causes block devices with Linux RAID (mdadm) signatures to
+# automatically cause mdadm to be run.
+# See udev(8) for syntax
+
+SUBSYSTEM=="block", ACTION=="add", \
+        ENV{ID_FS_TYPE}=="linux_raid_member|isw_raid_member", \
+        TEST!="/tmp/.mdraid_start-%k", \
+       IMPORT{program}="/sbin/mdadm --examine --export $tempnode", \
+       RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}", \
+       RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k; /bin/ln -s /sbin/mdraid_start /initqueue/mdraid_start.sh'"
index eef65670f49e14e4bf30e0f1d98fceaa2b3c8dda..0391957333780d6befc7b90f4a3e6633e6fc9331 100755 (executable)
@@ -12,7 +12,11 @@ instmods =drivers/md
 if [ -x /lib/udev/vol_id ]; then
     inst_rules "$moddir/61-mdadm.rules"
 else
-    inst_rules "$moddir/65-md-incremental.rules"
+    if mdadm -Q -e imsm /dev/null &> /dev/null; then
+        inst_rules "$moddir/65-md-incremental-imsm.rules"
+    else
+        inst_rules "$moddir/65-md-incremental.rules"
+    fi
     inst_rules 64-md-raid.rules
 fi
 
@@ -24,4 +28,4 @@ if [ -x  /sbin/mdmon ] ; then
 fi 
 
 inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
-
+inst grep
index 3475b7eb560a48b8166e0befdb08cfac548c11ae..7293dedf243b9f788007cc0026c508f0400caf0d 100755 (executable)
@@ -4,5 +4,14 @@ if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
     [ -h "$job" ] && rm -f "$job"
     # run mdadm if udev has settled
     mdadm -IRs
+    # and activate any containers
+    for md in /dev/md?*; do
+        case $md in
+            /dev/md*p*) ;;
+            *)
+                if mdadm --export --detail $md | grep -q container; then
+                    mdadm -IR $md
+                fi
+        esac
+    done
 fi
-