From 2e5eb135aac300032edd82e4b7a49a17dc80ba4d Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Tue, 27 Nov 2018 21:51:41 -0500 Subject: [PATCH] sd-image: Verifies the FAT partition before copying it. This is to ensure `mtools`-based operations don't wreck the FS. --- nixos/modules/installer/cd-dvd/sd-image.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/installer/cd-dvd/sd-image.nix b/nixos/modules/installer/cd-dvd/sd-image.nix index b6e1d11c2b54..e3b1ce3b7c42 100644 --- a/nixos/modules/installer/cd-dvd/sd-image.nix +++ b/nixos/modules/installer/cd-dvd/sd-image.nix @@ -135,6 +135,8 @@ in # Copy the populated /boot into the SD image (cd boot; mcopy -bpsvm -i ../bootpart.img ./* ::) + # Verify the FAT partition before copying it. + fsck.vfat -vn bootpart.img dd conv=notrunc if=bootpart.img of=$img seek=$START count=$SECTORS ''; }) {};