From: Marcin Krol Date: Tue, 14 Jul 2015 13:29:56 +0000 (+0000) Subject: - merged RAID/LVM init fixes X-Git-Tag: 0.4.14~5 X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=68a668470f74a2331d0bcc342bfbb9cccb40a6b5;p=rc-scripts.git - merged RAID/LVM init fixes --- diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 50ca08a..c1f4adb 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -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