summaryrefslogtreecommitdiffstats
path: root/nixos/lib/make-disk-image.nix
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-12-06 16:34:18 +0100
committerDomen Kožar <domen@dev.si>2016-12-07 13:30:20 +0100
commite5cca82d7969879c1b50f1cd9325ebbbfa76839f (patch)
tree2ead684987c9c5bf0c47de1491b3e0297f3c7b75 /nixos/lib/make-disk-image.nix
parenta11ad092d65d1ac63af1b9b8b6b39afa862d7c12 (diff)
make-disk-image: run tune2fs after umount to skip fsck
tune2fs marks the filesystem as clean to prevent resize2fs from complaining. But we were invoking it before we mounted the filesystem, so the counters would increase to 1 and it broke the functionality. By moving the call after the mount, I have confirmed it works by: $ nix-build nixos/tests/ec2.nix cc @rbvermaa @edolstra
Diffstat (limited to 'nixos/lib/make-disk-image.nix')
-rw-r--r--nixos/lib/make-disk-image.nix9
1 files changed, 4 insertions, 5 deletions
diff --git a/nixos/lib/make-disk-image.nix b/nixos/lib/make-disk-image.nix
index 58d0cb38d75f..b8411f5e5ecd 100644
--- a/nixos/lib/make-disk-image.nix
+++ b/nixos/lib/make-disk-image.nix
@@ -61,9 +61,6 @@ pkgs.vmTools.runInLinuxVM (
# Create an empty filesystem and mount it.
mkfs.${fsType} -L nixos $rootDisk
- ${optionalString (fsType == "ext4") ''
- tune2fs -c 0 -i 0 $rootDisk
- ''}
mkdir /mnt
mount $rootDisk /mnt
@@ -97,7 +94,9 @@ pkgs.vmTools.runInLinuxVM (
umount /mnt
- # Do a fsck to make sure resize2fs works.
- fsck.${fsType} -f -y $rootDisk
+ # Make sure resize2fs works
+ ${optionalString (fsType == "ext4") ''
+ tune2fs -c 0 -i 0 $rootDisk
+ ''}
''
)