[projects/rc-scripts] mdadm: accept "DEVICE partitions" as indication to start mdadm

glen glen at pld-linux.org
Sat Jan 18 00:09:48 CET 2014


commit a273d96fcc8e2d0729c83131b11171be24c823b6
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Jan 18 01:09:19 2014 +0200

    mdadm: accept "DEVICE partitions" as indication to start mdadm

 rc.d/rc.sysinit | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 27b3477..0b9d5c7 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -262,32 +262,42 @@ check_root_fs() {
 	fi
 }
 
-# Add raid devices
+# mdadm - manage MD devices aka Linux Software RAID
 init_mdadm() {
 	if [ ! -x /sbin/mdadm -o ! -f /etc/mdadm.conf ]; then
 		return
 	fi
 
 	modprobe -s md
-	local rc=0
+	local rc=0 golvm=0 have_md=0
 	if [ ! -f /proc/mdstat ]; then
 		return
 	fi
 
-	local golvm=0
+	# assume we have md if at least one ARRAY line is present
 	if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf; then
-		show "Starting up RAID devices"; busy
-		/sbin/mdadm --assemble --scan --auto=yes
-		rc=$?
-		if [ "$rc" -eq 0 -o "$rc" -eq 2 ]; then
-			# rc is used later too, so set sane value
-			rc=0
-			deltext; ok
-			golvm=1
-		else
-			deltext; fail
-		fi
+		have_md=1
+	fi
+	# configured to do auto scanning
+	if [ $have_md = 0 ] && grep -qE "^([[:blank:]]|)DEVICE[[:blank:]]partitions" /etc/mdadm.conf; then
+		have_md=1
+	fi
 
+	# none found
+	if [ $have_md = 0 ]; then
+		return
+	fi
+
+	show "Starting up RAID devices"; busy
+	/sbin/mdadm --assemble --scan --auto=yes
+	rc=$?
+	if [ "$rc" -eq 0 -o "$rc" -eq 2 ]; then
+		# rc is used later too, so set sane value
+		rc=0
+		deltext; ok
+		golvm=1
+	else
+		deltext; fail
 	fi
 
 	# A non-zero return means there were problems
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/a273d96fcc8e2d0729c83131b11171be24c823b6



More information about the pld-cvs-commit mailing list