From 647db4dd2a56345dfbae067eda926769c012e5f8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 21 Dec 2006 20:08:15 +0000 Subject: [PATCH] * Don't try to mount when the mount point isn't there yet. * Run fsck. svn path=/nixos/trunk/; revision=7458 --- configuration/upstart.nix | 2 +- upstart-jobs/filesystems.nix | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configuration/upstart.nix b/configuration/upstart.nix index f0870159ead..4065a030593 100644 --- a/configuration/upstart.nix +++ b/configuration/upstart.nix @@ -33,7 +33,7 @@ import ../upstart-jobs/gather.nix { # Mount file systems. (import ../upstart-jobs/filesystems.nix { - inherit (pkgs) utillinux; + inherit (pkgs) utillinux e2fsprogs; fileSystems = config.get ["fileSystems"]; }) diff --git a/upstart-jobs/filesystems.nix b/upstart-jobs/filesystems.nix index 6dcb8b3f2cf..c001bf14d8d 100644 --- a/upstart-jobs/filesystems.nix +++ b/upstart-jobs/filesystems.nix @@ -1,4 +1,4 @@ -{utillinux, fileSystems}: +{utillinux, e2fsprogs, fileSystems}: let @@ -18,6 +18,8 @@ start on startup start on new-devices script + PATH=${e2fsprogs}/sbin:$PATH + mountPoints=(${toString mountPoints}) devices=(${toString devices}) fsTypes=(${toString fsTypes}) @@ -39,6 +41,11 @@ script fsType=\${fsTypes[$n]} options=\${optionss[$n]} + if ! test -e \"$device\"; then + echo \"skipping $device, doesn't exist (yet)\" + continue + fi + # If $device is already mounted somewhere else, unmount it first. # !!! Note: we use /etc/mtab, not /proc/mounts, because mtab # contains more accurate info when using loop devices. @@ -63,6 +70,9 @@ script echo \"mounting $device on $mountPoint\" + # !!! should do something with the result; also prevent repeated fscks. + fsck -a \"$device\" || true + if ${utillinux}/bin/mount -t \"$fsType\" -o \"$options\" \"$device\" \"$mountPoint\"; then newDevices=1 fi