Skip to content

Commit

Permalink
Add support for wiping NVMe drives using nvme format, thanks @rluzuriaga
Browse files Browse the repository at this point in the history
  • Loading branch information
rluzuriaga authored Feb 28, 2023
1 parent 8b29992 commit 39cd6e7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 39cd6e7

Please sign in to comment.