diff options
author | Tuomas Tynkkynen <tuomas@tuxera.com> | 2018-05-05 19:02:50 +0300 |
---|---|---|
committer | Tuomas Tynkkynen <tuomas@tuxera.com> | 2018-05-05 19:30:54 +0300 |
commit | bc828721ed4ac138d791de47469a40e39046fb4a (patch) | |
tree | 040dbdb0c1e04c4253c69dd6f498731712ec7919 /nixos/lib | |
parent | 76d0e61e7b4878508af84268eb633fdc4ba53224 (diff) |
nixos/lib/make-ext4-fs: Add a sanity check
I ended up with a corrupted image with the debugfs contraption once, and given I couldn't reproduce the problem I suppose that happens if the filesystem of the builder runs out of space. At least in this instance fsck could detect it, so let's add it as a sanity check.
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/make-ext4-fs.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/lib/make-ext4-fs.nix b/nixos/lib/make-ext4-fs.nix index 986d80ff1b999..4095d9c6d00d4 100644 --- a/nixos/lib/make-ext4-fs.nix +++ b/nixos/lib/make-ext4-fs.nix @@ -14,7 +14,7 @@ in pkgs.stdenv.mkDerivation { name = "ext4-fs.img"; - nativeBuildInputs = with pkgs; [e2fsprogs libfaketime perl]; + nativeBuildInputs = with pkgs; [e2fsprogs.bin libfaketime perl]; buildCommand = '' @@ -83,5 +83,12 @@ pkgs.stdenv.mkDerivation { echo "--- Failed to create EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks) ---" return 1 fi + + # I have ended up with corrupted images sometimes, I suspect that happens when the build machine's disk gets full during the build. + if ! fsck.ext4 -n -f $out; then + echo "--- Fsck failed for EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks) ---" + cat errorlog + return 1 + fi ''; } |