From 16937dd23d5839bc60091dc30b4a3372a175145e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Jun 2009 16:47:37 +0000 Subject: [PATCH] * Make fsck on journaling filesystems optional (enabled by default). This is because fsck.ext3 takes several minutes to recover the journal, whereas the ext3 implementation in the kernel only takes a few seconds. I'd love to know why this is the case... svn path=/nixos/branches/modular-nixos/; revision=15965 --- modules/system/boot/stage-1-init.sh | 11 +++++++++++ modules/system/boot/stage-1.nix | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 3f11da28950..dd1fe0c886f 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -146,6 +146,17 @@ checkFS() { # Don't check ROM filesystems. if test "$FSTYPE" = iso9660 -o "$FSTYPE" = udf; then return 0; fi + # Optionally, skip fsck on journaling filesystems. This option is + # a hack - it's mostly because e2fsck on ext3 takes much longer to + # recover the journal than the ext3 implementation in the kernel + # does (minutes versus seconds). + if test -z "@checkJournalingFS@" -a \ + \( "$FSTYPE" = ext3 -o "$FSTYPE" = ext4 -o "$FSTYPE" = reiserfs \ + -o "$FSTYPE" = xfs -o "$FSTYPE" = jfs \) + then + return 0 + fi + # Don't run `fsck' if the machine is on battery power. !!! Is # this a good idea? if ! onACPower; then diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index c789205079b..565af8fdc8f 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -54,6 +54,14 @@ let "; }; + boot.initrd.checkJournalingFS = mkOption { + default = true; + type = types.bool; + description = '' + Whether to run fsck on journaling filesystems such as ext3. + ''; + }; + fileSystems = mkOption { options.neededForBoot = mkOption { default = false; @@ -215,6 +223,8 @@ let inherit (config.boot) isLiveCD resumeDevice; + inherit (config.boot.initrd) checkJournalingFS; + # !!! copy&pasted from upstart-jobs/filesystems.nix. mountPoints = if fileSystems == null