From be10dac1baff45e310deaa5ef45bf8980cd57d23 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 5 Aug 2014 15:26:26 +0000 Subject: [PATCH] - always try to assemble RAID arrays to get them all running - don't check exit status, mdadm incorrectly returns fail if some arrays are already assembled --- ...ts-raid.patch => rc-scripts-raid_lvm.patch | 43 +++++++++++++------ rc-scripts.spec | 4 +- 2 files changed, 33 insertions(+), 14 deletions(-) rename rc-scripts-raid.patch => rc-scripts-raid_lvm.patch (68%) diff --git a/rc-scripts-raid.patch b/rc-scripts-raid_lvm.patch similarity index 68% rename from rc-scripts-raid.patch rename to rc-scripts-raid_lvm.patch index 72bf0d9..f8691c0 100644 --- a/rc-scripts-raid.patch +++ b/rc-scripts-raid_lvm.patch @@ -1,11 +1,16 @@ diff -ur rc-scripts-0.4.12.orig/rc.d/rc.sysinit rc-scripts-0.4.12/rc.d/rc.sysinit ---- rc-scripts-0.4.12.orig/rc.d/rc.sysinit 2014-06-19 20:04:44.000000000 +0000 -+++ rc-scripts-0.4.12/rc.d/rc.sysinit 2014-07-25 16:08:09.735000000 +0000 -@@ -305,61 +305,18 @@ +--- rc-scripts-0.4.12.orig/rc.d/rc.sysinit 2014-08-05 14:20:11.411000000 +0000 ++++ rc-scripts-0.4.12/rc.d/rc.sysinit 2014-08-05 15:22:35.445000000 +0000 +@@ -301,63 +301,26 @@ + fi + } - # mdadm - manage MD devices aka Linux Software RAID +-# 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 @@ -19,9 +24,7 @@ diff -ur rc-scripts-0.4.12.orig/rc.d/rc.sysinit rc-scripts-0.4.12/rc.d/rc.sysini - # 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 -+ if ! grep -q -E "^md.*active" /proc/mdstat; then -+ run_cmd "Starting up RAID devices" /sbin/mdadm --assemble --scan - fi +- fi - # configured to do auto scanning - if [ $have_md = 0 ] && grep -qE "^([[:blank:]]|)DEVICE[[:blank:]]partitions" /etc/mdadm.conf; then - have_md=1 @@ -32,7 +35,7 @@ diff -ur rc-scripts-0.4.12.orig/rc.d/rc.sysinit rc-scripts-0.4.12/rc.d/rc.sysini - return - fi - -- show "Starting up RAID devices"; busy + show "Starting up RAID devices"; busy - /sbin/mdadm --assemble --scan --auto=yes - rc=$? - if [ "$rc" -eq 0 -o "$rc" -eq 2 ]; then @@ -52,7 +55,9 @@ diff -ur rc-scripts-0.4.12.orig/rc.d/rc.sysinit rc-scripts-0.4.12/rc.d/rc.sysini - 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 @@ -60,13 +65,27 @@ diff -ur rc-scripts-0.4.12.orig/rc.d/rc.sysinit rc-scripts-0.4.12/rc.d/rc.sysini - run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmsysinit - [ "$lvmversion" = "2" ] && /sbin/vgmknodes - fi -- fi ++ if [ -n "$output" ]; then ++ echo "$output" + fi - show "Starting up RAID devices"; ok - return $rc } # Init LVM -@@ -832,7 +789,10 @@ +@@ -390,8 +353,10 @@ + + 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 for case) ++ /sbin/vgmknodes $lvmignorelocking 1>/dev/null 2>&1 + # display VG statistics + /sbin/vgdisplay -s $lvmignorelocking + fi +@@ -830,7 +795,10 @@ fi fi @@ -78,7 +97,7 @@ diff -ur rc-scripts-0.4.12.orig/rc.d/rc.sysinit rc-scripts-0.4.12/rc.d/rc.sysini if ! is_no "$LVM2"; then init_lvm fi -@@ -844,10 +804,6 @@ +@@ -842,10 +810,6 @@ [ $delay_cryptsetup = 0 ] && ok || fail fi diff --git a/rc-scripts.spec b/rc-scripts.spec index fe17442..abe17ea 100644 --- a/rc-scripts.spec +++ b/rc-scripts.spec @@ -8,7 +8,7 @@ Summary(pl.UTF-8): inittab i skrypty startowe z katalogu /etc/rc.d Summary(tr.UTF-8): inittab ve /etc/rc.d dosyaları Name: rc-scripts Version: 0.4.12 -Release: 4 +Release: 5 License: GPL v2 Group: Base Source0: %{name}-%{version}.tar.gz @@ -22,7 +22,7 @@ Patch102: %{name}-selinuxfs_mount.patch Patch103: %{name}-sh_fixes.patch Patch104: %{name}-net-bond.patch Patch105: %{name}-net-br.patch -Patch106: %{name}-raid.patch +Patch106: %{name}-raid_lvm.patch Patch107: %{name}-misc.patch URL: http://svn.pld-linux.org/trac/svn/wiki/packages/rc-scripts BuildRequires: autoconf -- 2.46.0