From 39cd6e75f47debcb6f7552899b84c79a5e4660ce Mon Sep 17 00:00:00 2001 From: Rodrigo Luzuriaga Date: Tue, 28 Feb 2023 15:00:07 -0800 Subject: [PATCH] Add support for wiping NVMe drives using nvme format, thanks @rluzuriaga --- Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe b/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe index caafa39..ff1568a 100755 --- a/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe +++ b/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe @@ -11,23 +11,29 @@ echo " WARNING! You are about to destroy the contents of the following hard dis echo -e " $hd\n" echo -e " You have $seconds seconds to turn off this computer to cancel!\n" usleep $((seconds * 1000000)) + +[[ $hd == *[Nn][Vv][Mm][Ee]* ]] && wipemode="nvme" + case $wipemode in + nvme) + echo -e " Starting disk wipe of $hd using nvme format...\n" + usleep 10000000 + nvme format $hd --force + ;; full) echo -e " Starting full disk wipe of $hd using shred...\n" usleep 10000000 shred -f -v -z -n 3 "$hd" - echo -e "\n Wiping complete.\n" ;; normal) echo -e " Starting normal disk wipe of $hd using shred...\n" usleep 10000000 shred -f -v -n 1 "$hd" - echo -e "\n Wiping complete.\n" ;; fast|fastwipe) echo " Writing zeros to start of $hd" dd if=/dev/zero of="$hd" bs=512 count=100000 - echo -e "\n Wiping complete.\n" ;; esac +echo -e "\n Wiping complete.\n" . /bin/fog.nonimgcomplete