Skip to content

Instantly share code, notes, and snippets.

@nataz77
Created January 27, 2022 10:38
Show Gist options
  • Save nataz77/009ead24bfbcff2edc6a13baea590e46 to your computer and use it in GitHub Desktop.
Save nataz77/009ead24bfbcff2edc6a13baea590e46 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
DISK="/dev/sda"
# Zap the disk to a fresh, usable state (zap-all is important, b/c MBR has to be clean)
# You will have to run this step for all disks.
sgdisk --zap-all $DISK
# Clean hdds with dd
dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync
# Clean disks such as ssd with blkdiscard instead of dd
blkdiscard $DISK
# These steps only have to be run once on each node
# If rook sets up osds using ceph-volume, teardown leaves some devices mapped that lock the disks.
ls /dev/mapper/ceph-* | xargs -I% -- dmsetup remove %
# ceph-volume setup can leave ceph-<UUID> directories in /dev (unnecessary clutter)
rm -rf /dev/ceph-*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment