From e5cca82d7969879c1b50f1cd9325ebbbfa76839f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 6 Dec 2016 16:34:18 +0100 Subject: [PATCH] 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 --- nixos/lib/make-disk-image.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nixos/lib/make-disk-image.nix b/nixos/lib/make-disk-image.nix index 58d0cb38d75..b8411f5e5ec 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 + ''} '' )