diff --git a/scripts/cleanup-nvme.sh b/scripts/cleanup-nvme.sh new file mode 100644 index 0000000..b35d2fe --- /dev/null +++ b/scripts/cleanup-nvme.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +DISK="/dev/nvme0n1" + +# Zap the disk to a fresh, usable state (zap-all is important, b/c MBR has to be clean) +sgdisk --zap-all $DISK + +# Wipe a large portion of the beginning of the disk to remove more LVM metadata that may be present +dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync + +# SSDs may be better cleaned with blkdiscard instead of dd +blkdiscard $DISK + +# Inform the OS of partition table changes +partprobe $DISK \ No newline at end of file