]> TLD Linux GIT Repositories - rc-scripts.git/commitdiff
- merged RAID/LVM init fixes
authorMarcin Krol <hawk@tld-linux.org>
Tue, 14 Jul 2015 13:29:56 +0000 (13:29 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Tue, 14 Jul 2015 13:29:56 +0000 (13:29 +0000)
rc.d/rc.sysinit

index 50ca08a247591fc1f33d68925bc3deb5551d8f53..c1f4adb8eb8cd3e1aa830208fd84f46ce6217fab 100755 (executable)
@@ -297,63 +297,26 @@ check_root_fs() {
        fi
 }
 
-# mdadm - manage MD devices aka Linux Software RAID
+# Init software RAID arrays
 init_mdadm() {
-       if [ ! -x /sbin/mdadm -o ! -f /etc/mdadm.conf ]; then
+       local output
+
+       if [ ! -x /sbin/mdadm ]; then
                return
        fi
 
        modprobe -s md
-       local rc=0 golvm=0 have_md=0
        if [ ! -f /proc/mdstat ]; then
                return
        fi
 
-       # assume we have md if at least one ARRAY line is present
-       if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf; then
-               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
-       if [ $rc -gt 0 ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               show "Starting up RAID devices"; fail
-
-               PS1="$(nls '(RAID Repair)# ')"; export PS1
-               repair_shell "$(nls '*** An error occurred during the RAID startup.')"
-       fi
+       output=$(/sbin/mdadm --assemble --scan 2>&1)
+       ok
 
-       # LVM on RAID (keep in sync with LVM init)
-       if [ "$golvm" -eq "1" ]; then
-               if [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
-                       run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelocking
-                       run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmsysinit
-                       [ "$lvmversion" = "2" ] && /sbin/vgmknodes
-               fi
+       if [ -n "$output" ]; then
+               echo "$output"
        fi
-       show "Starting up RAID devices"; ok
-       return $rc
 }
 
 # Init LVM
@@ -386,8 +349,10 @@ init_lvm() {
 
        run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelocking
        run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmsysinit
+
        if [ "$lvmversion" = "2" ]; then
-               /sbin/vgmknodes $lvmignorelocking
+               # silently refresh LV /dev nodes (just in case)
+               /sbin/vgmknodes $lvmignorelocking 1>/dev/null 2>&1
                # display VG statistics
                /sbin/vgdisplay -s $lvmignorelocking
        fi
@@ -820,7 +785,10 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
                fi
        fi
 
-       # Init LVM
+       if ! is_no "$MDADM"; then
+               init_mdadm
+       fi
+
        if ! is_no "$LVM2"; then
                init_lvm
        fi
@@ -832,10 +800,6 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
                [ $delay_cryptsetup = 0 ] && ok || fail
        fi
 
-       if ! is_no "$MDADM"; then
-               init_mdadm
-       fi
-
        _RUN_QUOTACHECK=0
        # Check filesystems
        if [ -z "$fastboot" ] && [ -z "$nofsck" ]; then