summaryrefslogtreecommitdiff
path: root/scripts/local-top
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/local-top')
-rwxr-xr-xscripts/local-top/lvm6
-rwxr-xr-xscripts/local-top/mdraid41
2 files changed, 46 insertions, 1 deletions
diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm
index 9a45220..f9d1490 100755
--- a/scripts/local-top/lvm
+++ b/scripts/local-top/lvm
@@ -1,6 +1,6 @@
#!/bin/sh
-PREREQ="mdadm"
+PREREQ="mdadm mdraid lvm2"
prereqs()
{
@@ -56,6 +56,10 @@ activate_vg()
vgchange -ay ${vg}
}
+if [ -e /scripts/local-top/lvm2 ]; then
+ exit 0
+fi
+
if [ ! -e /sbin/vgchange ]; then
exit 0
fi
diff --git a/scripts/local-top/mdraid b/scripts/local-top/mdraid
new file mode 100755
index 0000000..2cf3b5d
--- /dev/null
+++ b/scripts/local-top/mdraid
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+PREREQ="udev_helper"
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+if [ -e /scripts/local-top/mdadm ]; then
+ exit 0
+fi
+
+unset raidlvl
+gotraid=n
+
+# Detect raid level
+for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do
+ if [ ! -e ${x} ]; then
+ continue
+ fi
+ raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/')
+ if [ "$raidlvl" ]; then
+ modprobe -q ${raidlvl} 2>/dev/null
+ gotraid=y
+ fi
+done
+
+[ "${gotraid}" = y ] || exit
+
+# Assemble all raid devices
+mkdir /dev/md
+mdadm --assemble --config=/etc/mdadm.conf --scan --run --auto=yes