blob: 2f2496910f7be7f303d3feeeef6df6efec8cd13d [file] [log] [blame]
giolekva875548d2022-05-20 18:41:36 +04001#!/usr/bin/env bash
2DISK="/dev/sda3"
3
4# Zap the disk to a fresh, usable state (zap-all is important, b/c MBR has to be clean)
5
6# You will have to run this step for all disks.
7sgdisk --zap-all $DISK
8
9# Clean hdds with dd
10dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync
11
12# Clean disks such as ssd with blkdiscard instead of dd
13blkdiscard $DISK
14
15# These steps only have to be run once on each node
16# If rook sets up osds using ceph-volume, teardown leaves some devices mapped that lock the disks.
17ls /dev/mapper/ceph-* | xargs -I% -- dmsetup remove %
18
19# ceph-volume setup can leave ceph-<UUID> directories in /dev and /dev/mapper (unnecessary clutter)
20rm -rf /dev/ceph-*
21rm -rf /dev/mapper/ceph--*
22
23# Inform the OS of partition table changes
24partprobe $DISK