Hi all, attached is a patch to change the dependencies during early boot. The current mechanism runs all disk scripts before swap is configured. swap itself is required by fsck, which in turn is required to mount the root filesystem. This is bad for LVM as it needs a writable /dev. The patch splits things up: First, fsck of / and mounting it. Second, run the "DISKS" scripts. Third, setup swap and fsck. Fourth, mount other local filesystems. Other effects of the patch: - run wdogctl before mounting root - run rndctl after wdogctl, but before disks and cgd Comments? Testers? Joerg
Index: ccd =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/ccd,v retrieving revision 1.5 diff -u -p -r1.5 ccd --- ccd 13 Aug 2004 18:08:03 -0000 1.5 +++ ccd 15 Apr 2009 22:43:00 -0000 @@ -3,7 +3,8 @@ # $NetBSD: ccd,v 1.5 2004/08/13 18:08:03 mycroft Exp $ # -# PROVIDE: disks +# PROVIDE: ccd +# BEFORE: DISKS $_rc_subr_loaded . /etc/rc.subr Index: cgd =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/cgd,v retrieving revision 1.5 diff -u -p -r1.5 cgd --- cgd 2 Mar 2005 19:09:22 -0000 1.5 +++ cgd 15 Apr 2009 22:46:50 -0000 @@ -3,7 +3,9 @@ # $NetBSD: cgd,v 1.5 2005/03/02 19:09:22 tv Exp $ # -# PROVIDE: disks +# PROVIDE: cgd +# REQUIRE: rndctl +# BEFORE: DISKS $_rc_subr_loaded . /etc/rc.subr Index: fsck_root =================================================================== RCS file: fsck_root diff -N fsck_root --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ fsck_root 15 Apr 2009 22:14:16 -0000 @@ -0,0 +1,52 @@ +#!/bin/sh +# +# $NetBSD: fsck,v 1.9 2008/03/02 21:31:30 tron Exp $ +# + +# PROVIDE: fsck_root + +$_rc_subr_loaded . /etc/rc.subr + +name="fsck_root" +start_cmd="fsck_root_start" +stop_cmd=":" + +fsck_root_start() +{ + if [ -e /fastboot ]; then + echo "Fast boot: skipping disk checks." + return + fi + trap : 2 # Ignore SIGINT, SIGQUIT, so we + trap : 3 # enter single-user mode on failure. + + echo "Starting file system checks:" + fsck $fsck_flags / + local fsck_error="$?" + case $fsck_error in + 0) # OK + return + ;; + 2) # Needs re-run, still fs errors + echo "file systems still have errors; re-run fsck manually!" + ;; + 4) # Root modified + echo "Root filesystem was modified, rebooting ..." + reboot + echo "Reboot failed; help!" + ;; + 8) # Check failed + echo "Automatic file system check failed; help!" + ;; + 12) # Got signal + echo "Boot interrupted." + ;; + *) + echo "Unknown error $fsck_error; help!" + ;; + esac + stop_boot +} + +load_rc_config $name +run_rc_command "$1" Index: lvm =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/lvm,v retrieving revision 1.3 diff -u -p -r1.3 lvm --- lvm 5 Mar 2009 10:35:43 -0000 1.3 +++ lvm 15 Apr 2009 22:46:06 -0000 @@ -3,7 +3,9 @@ # $NetBSD: lvm,v 1.3 2009/03/05 10:35:43 haad Exp $ # -# PROVIDE: disks +# PROVIDE: lvm +# REQUIRE: root +# BEFORE: DISKS $_rc_subr_loaded . /etc/rc.subr Index: mountcritlocal =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/mountcritlocal,v retrieving revision 1.9 diff -u -p -r1.9 mountcritlocal --- mountcritlocal 12 Nov 2006 01:22:58 -0000 1.9 +++ mountcritlocal 15 Apr 2009 22:19:26 -0000 @@ -4,7 +4,7 @@ # # PROVIDE: mountcritlocal -# REQUIRE: root +# REQUIRE: fsck $_rc_subr_loaded . /etc/rc.subr Index: raidframe =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/raidframe,v retrieving revision 1.9 diff -u -p -r1.9 raidframe --- raidframe 13 Aug 2004 18:08:03 -0000 1.9 +++ raidframe 15 Apr 2009 22:43:19 -0000 @@ -3,7 +3,8 @@ # $NetBSD: raidframe,v 1.9 2004/08/13 18:08:03 mycroft Exp $ # -# PROVIDE: disks +# PROVIDE: raidframe +# BEFORE: DISKS $_rc_subr_loaded . /etc/rc.subr Index: rndctl =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/rndctl,v retrieving revision 1.2 diff -u -p -r1.2 rndctl --- rndctl 2 Feb 2009 09:24:47 -0000 1.2 +++ rndctl 15 Apr 2009 22:57:05 -0000 @@ -4,7 +4,8 @@ # # PROVIDE: rndctl -# BEFORE: disks ike ipsec sshd +# BEFORE: DISKS ike ipsec sshd +# REQUIRE: wdogctl $_rc_subr_loaded . /etc/rc.subr Index: root =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/root,v retrieving revision 1.3 diff -u -p -r1.3 root --- root 13 Aug 2004 18:08:03 -0000 1.3 +++ root 15 Apr 2009 22:14:35 -0000 @@ -4,7 +4,7 @@ # # PROVIDE: root -# REQUIRE: fsck +# REQUIRE: fsck_root $_rc_subr_loaded . /etc/rc.subr Index: swap1 =================================================================== RCS file: /home/joerg/repo/netbsd/src/etc/rc.d/swap1,v retrieving revision 1.9 diff -u -p -r1.9 swap1 --- swap1 13 Aug 2004 18:08:03 -0000 1.9 +++ swap1 15 Apr 2009 22:16:18 -0000 @@ -4,7 +4,7 @@ # # PROVIDE: localswap -# REQUIRE: disks +# REQUIRE: DISKS root # KEYWORD: shutdown $_rc_subr_loaded . /etc/rc.subr
Attachment:
rc-lvm.svg.gz
Description: application/gunzip