forked from pool/mdadm
checked in (request 29764)
OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=13
This commit is contained in:
parent
b593e3099a
commit
410dbf2ce6
10
boot.md
10
boot.md
@ -98,14 +98,6 @@ 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 "
|
||||||
|
|
||||||
@ -118,7 +110,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 md_mod
|
[ ! -f /proc/mdstat -a -x /sbin/modprobe ] && /sbin/modprobe -k md_mod 2>&1 | :
|
||||||
[ -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,15 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
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,25 +70,13 @@ 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
|
||||||
rm -rf $RPM_BUILD_ROOT/var/run/mdadm
|
install -d $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
|
||||||
@ -112,7 +100,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
|
||||||
%ghost /var/run/mdadm
|
%dir /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,11 +18,6 @@
|
|||||||
# 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)
|
||||||
@ -54,19 +49,9 @@ md_assemble()
|
|||||||
else
|
else
|
||||||
mdconf="-c partitions"
|
mdconf="-c partitions"
|
||||||
fi
|
fi
|
||||||
case "$container" in
|
if test -n "$container"; then
|
||||||
"")
|
|
||||||
;;
|
|
||||||
/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,6 +12,7 @@ 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
|
||||||
@ -42,36 +43,46 @@ for bd in $blockdev ; do
|
|||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
mdconf=$(mdadm -Db "$bd")
|
# Get UUID of block device
|
||||||
if test -z "$mdconf"; then
|
tmp_uuid=$(mdadm -D $bd --export 2>/dev/null | grep UUID=)
|
||||||
mdblockdev="$mdblockdev $bd"
|
if [ -n "$tmp_uuid" ]; then
|
||||||
continue
|
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
|
||||||
|
fi
|
||||||
|
# Check for container
|
||||||
|
cont_line=
|
||||||
|
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")
|
||||||
|
if [ -n "$cont" ]; then
|
||||||
|
cnt_dup=0
|
||||||
|
for cnt in $cont_list; do
|
||||||
|
if [ x"$cont"= x"$cnt" ]; then
|
||||||
|
cnt_dup=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $cnt_dup -eq 0 ]; then
|
||||||
|
cont_list="$cont_list $cont"
|
||||||
|
cont_line=$(echo "$mdadm_conf" | grep "UUID=$cont")
|
||||||
|
cont_line="$cont_line\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# add a line with the "real" md device name so that boot-md.sh finds it
|
||||||
|
cfg_dev=$(echo "$arr_line" | sed -rn 's/^ARRAY +([^ ]*).*/\1/p; T; q')
|
||||||
|
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" | \
|
||||||
|
sed -r "s:^(ARRAY +)$cfg_dev:\\1$real_dev:")"
|
||||||
|
fi
|
||||||
|
mdblockdev="$mdblockdev $md_tmpblockdev"
|
||||||
|
# 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
|
||||||
fi
|
fi
|
||||||
md_tmpblockdev=$(mdadm -Dbv $bd | sed -n "1D;s/,/ /g;s/^ *devices=//p")
|
|
||||||
mdblockdev="$mdblockdev $md_tmpblockdev"
|
|
||||||
md_devs="$md_devs $md_dev"
|
|
||||||
container=$(echo "$mdconf" | sed -rn 's/.* container=([^ ]*) .*/\1/p')
|
|
||||||
for cnt in $cont_list; do
|
|
||||||
if [ x"$container"= x"$cnt" ]; then
|
|
||||||
container=
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
case "$container" in
|
|
||||||
"")
|
|
||||||
;;
|
|
||||||
/dev/*)
|
|
||||||
mdconf="$(mdadm -Db "$container")\\n$mdconf"
|
|
||||||
;;
|
|
||||||
[0-9a-f]*[0-9a-f])
|
|
||||||
mdconf="$(mdadm -Ebs | grep "UUID=$container")\\n$mdconf"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "unrecognized container for $md_dev: $container"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
eval md_conf_${md_dev}=\"$mdconf\"
|
|
||||||
root_md=1
|
|
||||||
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