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
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
fi
fi
- # Init LVM
+ if ! is_no "$MDADM"; then
+ init_mdadm
+ fi
+
if ! is_no "$LVM2"; then
init_lvm
fi
[ $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