Skip to content

Commit

Permalink
Added cleanup nvme script
Browse files Browse the repository at this point in the history
  • Loading branch information
mmontes11 committed Sep 1, 2024
1 parent f2a86bc commit 38b3ba0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/cleanup-nvme.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 38b3ba0

Please sign in to comment.