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