Skip to content

Commit 38b3ba0

Browse files
committed
Added cleanup nvme script
1 parent f2a86bc commit 38b3ba0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/cleanup-nvme.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
DISK="/dev/nvme0n1"
4+
5+
# Zap the disk to a fresh, usable state (zap-all is important, b/c MBR has to be clean)
6+
sgdisk --zap-all $DISK
7+
8+
# Wipe a large portion of the beginning of the disk to remove more LVM metadata that may be present
9+
dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync
10+
11+
# SSDs may be better cleaned with blkdiscard instead of dd
12+
blkdiscard $DISK
13+
14+
# Inform the OS of partition table changes
15+
partprobe $DISK

0 commit comments

Comments
 (0)