forked from pool/mdadm
Accepting request 29763 from home:michal-m:branches:Base:System
Copy from home:michal-m:branches:Base:System/mdadm via accept of submit request 29763 revision 2. Request was accepted with message: Reviewed ok OBS-URL: https://build.opensuse.org/request/show/29763 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=12
This commit is contained in:
parent
b9f2c8ae10
commit
b593e3099a
10
boot.md
10
boot.md
@ -98,6 +98,14 @@ case "$1" in
|
|||||||
start)
|
start)
|
||||||
echo -n "Starting MD Raid "
|
echo -n "Starting MD Raid "
|
||||||
|
|
||||||
|
# create the /var/run/mdadm symlink if needed
|
||||||
|
mkdir -p /dev/.mdadm
|
||||||
|
if test ! /dev/.mdadm -ef /var/run/mdadm; then
|
||||||
|
rm -rf /var/run/mdadm
|
||||||
|
ln -s /dev/.mdadm /var/run/mdadm
|
||||||
|
fi
|
||||||
|
# restart mdmon (exits silently if there is nothing to monitor)
|
||||||
|
/sbin/mdmon /proc/mdstat /
|
||||||
# Check for existence of needed config file and read it
|
# Check for existence of needed config file and read it
|
||||||
[ -r $mdadm_SYSCONFIG ] || _rc_exit 6 "... $mdadm_SYSCONFIG not existing "
|
[ -r $mdadm_SYSCONFIG ] || _rc_exit 6 "... $mdadm_SYSCONFIG not existing "
|
||||||
|
|
||||||
@ -110,7 +118,7 @@ case "$1" in
|
|||||||
[ -x $mdadm_BIN ] || _rc_exit 5 "... $mdadm_BIN not installed "
|
[ -x $mdadm_BIN ] || _rc_exit 5 "... $mdadm_BIN not installed "
|
||||||
|
|
||||||
# Try to load md_mod
|
# Try to load md_mod
|
||||||
[ ! -f /proc/mdstat -a -x /sbin/modprobe ] && /sbin/modprobe -k md_mod 2>&1 | :
|
[ ! -f /proc/mdstat -a -x /sbin/modprobe ] && /sbin/modprobe md_mod
|
||||||
[ -f /proc/mdstat ] || _rc_exit 5 "... no MD support in kernel "
|
[ -f /proc/mdstat ] || _rc_exit 5 "... no MD support in kernel "
|
||||||
|
|
||||||
# Wait for udev to settle
|
# Wait for udev to settle
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 15 17:37:26 CET 2010 - mmarek@suse.cz
|
||||||
|
|
||||||
|
- fix modprobe invocation in boot.md (bnc#565293).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 15 17:04:06 CET 2010 - mmarek@suse.cz
|
||||||
|
|
||||||
|
- store mdmon runtime files in /dev/.mdadm, to make it easier to
|
||||||
|
transfer mdmon from the initrd to the real root.
|
||||||
|
- rework the mkinitrd setup script a bit.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 6 15:47:03 CET 2010 - mmarek@suse.cz
|
Wed Jan 6 15:47:03 CET 2010 - mmarek@suse.cz
|
||||||
|
|
||||||
|
16
mdadm.spec
16
mdadm.spec
@ -70,13 +70,25 @@ install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-md.sh
|
|||||||
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-md.sh
|
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-md.sh
|
||||||
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
|
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
|
||||||
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
|
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
|
||||||
install -d $RPM_BUILD_ROOT/var/run/mdadm
|
rm -rf $RPM_BUILD_ROOT/var/run/mdadm
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/var/run
|
||||||
|
ln -s mdadm $RPM_BUILD_ROOT/var/run/mdadm
|
||||||
# remove here, using the one in the udev package
|
# remove here, using the one in the udev package
|
||||||
rm -f $RPM_BUILD_ROOT/lib/udev/rules.d/64-md-raid.rules
|
rm -f $RPM_BUILD_ROOT/lib/udev/rules.d/64-md-raid.rules
|
||||||
|
|
||||||
%post
|
%post
|
||||||
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
|
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
|
||||||
%{fillup_and_insserv -y boot.md}
|
%{fillup_and_insserv -y boot.md}
|
||||||
|
mkdir -p /dev/.mdadm
|
||||||
|
# replace the /var/run/mdadm directory (installed by sle11/11.1) with
|
||||||
|
# a symlink pointing to /dev/.mdadm. Do not do this when /var/run/mdadm is
|
||||||
|
# not empty, let /etc/init.d/boot.md do it at the next reboot.
|
||||||
|
if test -e /var/run/mdadm -a ! /var/run/mdadm -ef /dev/.mdadm; then
|
||||||
|
if ! rmdir /var/run/mdadm 2>/dev/null; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
ln -s /dev/.mdadm /var/run/mdadm
|
||||||
|
fi
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%restart_on_update mdadmd
|
%restart_on_update mdadmd
|
||||||
@ -100,7 +112,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%dir /lib/udev/devices
|
%dir /lib/udev/devices
|
||||||
%{_sbindir}/*
|
%{_sbindir}/*
|
||||||
%{_var}/adm/fillup-templates/sysconfig.mdadm
|
%{_var}/adm/fillup-templates/sysconfig.mdadm
|
||||||
%dir /var/run/mdadm
|
%ghost /var/run/mdadm
|
||||||
%dir /lib/mkinitrd
|
%dir /lib/mkinitrd
|
||||||
%dir /lib/mkinitrd/scripts
|
%dir /lib/mkinitrd/scripts
|
||||||
/lib/mkinitrd/scripts/setup-md.sh
|
/lib/mkinitrd/scripts/setup-md.sh
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
# load the necessary module before we initialize the raid system
|
# load the necessary module before we initialize the raid system
|
||||||
load_modules
|
load_modules
|
||||||
|
|
||||||
|
# put the mdmon socked and pid file to /dev/.mdadm
|
||||||
|
rm -rf /var/run/mdadm
|
||||||
|
mkdir -p /var/run
|
||||||
|
ln -s /dev/.mdadm /var/run/mdadm
|
||||||
|
mkdir -p /dev/.mdadm
|
||||||
[ "$mduuid" ] && md_uuid="$mduuid"
|
[ "$mduuid" ] && md_uuid="$mduuid"
|
||||||
|
|
||||||
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
|
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
|
||||||
@ -49,9 +54,19 @@ md_assemble()
|
|||||||
else
|
else
|
||||||
mdconf="-c partitions"
|
mdconf="-c partitions"
|
||||||
fi
|
fi
|
||||||
if test -n "$container"; then
|
case "$container" in
|
||||||
|
"")
|
||||||
|
;;
|
||||||
|
/dev/*)
|
||||||
|
mdadm -A $mdconf $container
|
||||||
|
;;
|
||||||
|
[0-9a-f]*[0-9a-f])
|
||||||
mdadm -A $mdconf --uuid="$container" /dev/md/container
|
mdadm -A $mdconf --uuid="$container" /dev/md/container
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
|
echo "unrecognized container for $dev: $container"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
mdadm -A $mdconf $mdarg "$dev"
|
mdadm -A $mdconf $mdarg "$dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ cont_list=
|
|||||||
md_devs=
|
md_devs=
|
||||||
|
|
||||||
# blockdev contains real devices (/dev/X) for root, resume, journal, dumb
|
# blockdev contains real devices (/dev/X) for root, resume, journal, dumb
|
||||||
echo "blockdev: $blockdev"
|
|
||||||
for bd in $blockdev ; do
|
for bd in $blockdev ; do
|
||||||
is_part_dev=false
|
is_part_dev=false
|
||||||
case $bd in
|
case $bd in
|
||||||
@ -43,46 +42,36 @@ for bd in $blockdev ; do
|
|||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# Get UUID of block device
|
mdconf=$(mdadm -Db "$bd")
|
||||||
tmp_uuid=$(mdadm -D $bd --export 2>/dev/null | grep UUID=)
|
if test -z "$mdconf"; then
|
||||||
if [ -n "$tmp_uuid" ]; then
|
mdblockdev="$mdblockdev $bd"
|
||||||
md_tmpblockdev=$(mdadm -Dbv $bd 2> /dev/null | sed -n "1D;s/,/ /g;s/^ *devices=\(.*\)/\1/p")
|
|
||||||
uuid=${tmp_uuid##MD_}
|
|
||||||
# Get the corresponding line from config
|
|
||||||
arr_line=$(echo "$mdadm_conf" | grep "$uuid")
|
|
||||||
if test -z "$arr_line"; then
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# Check for container
|
md_tmpblockdev=$(mdadm -Dbv $bd | sed -n "1D;s/,/ /g;s/^ *devices=//p")
|
||||||
cont_line=
|
mdblockdev="$mdblockdev $md_tmpblockdev"
|
||||||
cont=$(echo "$arr_line" | sed -n "s/.*container=\([0-9a-z]\{8\}:[0-9a-z]\{8\}:[0-9a-z]\{8\}:[0-9a-z]\{8\}\).*/\1/p")
|
md_devs="$md_devs $md_dev"
|
||||||
if [ -n "$cont" ]; then
|
container=$(echo "$mdconf" | sed -rn 's/.* container=([^ ]*) .*/\1/p')
|
||||||
cnt_dup=0
|
|
||||||
for cnt in $cont_list; do
|
for cnt in $cont_list; do
|
||||||
if [ x"$cont"= x"$cnt" ]; then
|
if [ x"$container"= x"$cnt" ]; then
|
||||||
cnt_dup=1
|
container=
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ $cnt_dup -eq 0 ]; then
|
case "$container" in
|
||||||
cont_list="$cont_list $cont"
|
"")
|
||||||
cont_line=$(echo "$mdadm_conf" | grep "UUID=$cont")
|
;;
|
||||||
cont_line="$cont_line\n"
|
/dev/*)
|
||||||
fi
|
mdconf="$(mdadm -Db "$container")\\n$mdconf"
|
||||||
fi
|
;;
|
||||||
# add a line with the "real" md device name so that boot-md.sh finds it
|
[0-9a-f]*[0-9a-f])
|
||||||
cfg_dev=$(echo "$arr_line" | sed -rn 's/^ARRAY +([^ ]*).*/\1/p; T; q')
|
mdconf="$(mdadm -Ebs | grep "UUID=$container")\\n$mdconf"
|
||||||
real_dev=$(readlink -f "$cfg_dev")
|
;;
|
||||||
if test -n "$real_dev" -a "$real_dev" != "$cfg_dev"; then
|
*)
|
||||||
arr_line="$arr_line$(echo -e "\\n$arr_line" | \
|
echo "unrecognized container for $md_dev: $container"
|
||||||
sed -r "s:^(ARRAY +)$cfg_dev:\\1$real_dev:")"
|
;;
|
||||||
fi
|
esac
|
||||||
mdblockdev="$mdblockdev $md_tmpblockdev"
|
eval md_conf_${md_dev}=\"$mdconf\"
|
||||||
# Add ARRAY line (with container line before if needed).
|
|
||||||
cfg_line=$(echo -e "$cont_line$arr_line")
|
|
||||||
eval md_conf_${md_dev}=\""$cfg_line"\"
|
|
||||||
md_devs="$md_devs $md_dev"
|
|
||||||
root_md=1
|
root_md=1
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Any 'md' device is replaced by it's component disks.
|
# Any 'md' device is replaced by it's component disks.
|
||||||
|
Loading…
Reference in New Issue
Block a user