From f563cfcdf9dc932b323771965fe983bac439587f Mon Sep 17 00:00:00 2001 From: Jens Nolte <git@queezle.net> Date: Sat, 14 Aug 2021 23:55:42 +0200 Subject: [PATCH] installation: Wipe partition table so blkdiscard does not fail We want blkdiscard to fail if the device is no ssd, but it will also fail if the device already has a partition table. --- bin/lib/installation.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/lib/installation.nix b/bin/lib/installation.nix index 05c4423..45df5d7 100644 --- a/bin/lib/installation.nix +++ b/bin/lib/installation.nix @@ -125,6 +125,12 @@ assert (typeOf swap) == "string"; exit 3 fi + print_info "Wiping partition table" + dd if=/dev/zero of=$block_device bs=1M count=1 conv=fsync + + # Ensure partition table changes have been registered by the kernel + ${partprobe-bin} $block_device + print_info "Discarding disk contents" if ${blkdiscard-bin} $block_device then -- GitLab