Subject: proposed changes to RAIDframe related rc.d scripts
To: None <current-users@netbsd.org>
From: Jukka Salmi <j+nbsd@2005.salmi.ch>
List: current-users
Date: 04/22/2005 19:14:21
--9UV9rz0O2dU/yYYn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
on a NetBSD system using RAIDframe and default rc.d scripts, parity
checking the RAID set is done late in the boot process:
$ rcorder -s nostart * | tail
postfix
smmsp
raidframeparity
poffd
ndbootd
moused
mixerctl
inetd
identd
cron
Furthermore it's done in the background: until it succeeds the data is
not protected against a component failure.
Parity checking was split out of /etc/rc.d/raidframe (which is executed
early) about 2.5 years ago to not "end up with fsck and raidframe parity
rebuild taking forever after a crash/reboot".
I'd appreciate the possibility to choose whether parity checking should
be done as early as possible (i.e. before fsck runs and filesystems are
mounted) and in the foreground, or as it is right now (late and in the
background).
The attached patch adds this functionality: setting raidframeparity_early
to NO (the default) doesn't change any behaviour; setting it to YES runs
the parity check right after non-auto-configured RAID sets are configured
and in the foreground. (Hmm, should it terminate the boot process if it
fails, like /etc/rc.d/fsck?)
Comments are welcome!
Cheers, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
--9UV9rz0O2dU/yYYn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="RAIDframe-parity_rc.d.patch"
--- src/etc/defaults/rc.conf.orig 2004-10-18 02:24:26.000000000 +0200
+++ src/etc/defaults/rc.conf 2005-04-22 01:33:19.000000000 +0200
@@ -89,6 +89,12 @@
#
raidframe=YES
+# RAIDframe parity check.
+#
+raidframeparity_early=NO # Set to YES to have parity check done as
+ # soon as possible and to pause the boot
+ # process until it completes.
+
# Crypto file system.
#
cgd=YES
--- src/etc/rc.d/raidframe.orig 2004-10-18 02:24:27.000000000 +0200
+++ src/etc/rc.d/raidframe 2005-04-22 01:09:12.000000000 +0200
@@ -4,6 +4,7 @@
#
# PROVIDE: disks
+# BEFORE: raidframeparity1
$_rc_subr_loaded . /etc/rc.subr
--- src/etc/rc.d/raidframeparity.orig 2004-10-18 02:24:27.000000000 +0200
+++ src/etc/rc.d/raidframeparity 2005-04-22 01:17:45.000000000 +0200
@@ -9,6 +9,7 @@
name="raidframeparity"
start_cmd="raidframeparity_start"
+start_precmd="! checkyesno raidframeparity_early"
stop_cmd=":"
raidframeparity_start()
--- /dev/null 2005-04-22 01:33:10.000000000 +0200
+++ src/etc/rc.d/raidframeparity1 2005-04-22 01:18:03.000000000 +0200
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $NetBSD$
+#
+
+# PROVIDE: disks raidframeparity1
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="raidframeparity1"
+start_cmd="raidframeparity1_start"
+start_precmd="checkyesno raidframeparity_early"
+stop_cmd=":"
+
+raidframeparity1_start()
+{
+ # Initiate parity/mirror reconstruction as needed
+ #
+ for dev in $(sysctl -n hw.disknames); do
+ case $dev in
+ raid[0-9]*)
+ raidctl -v -P $dev
+ ;;
+ esac
+ done
+}
+
+load_rc_config $name
+run_rc_command "$1"
--9UV9rz0O2dU/yYYn--