| giolekva | 875548d | 2022-05-20 18:41:36 +0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | DISK="/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. |
| 7 | sgdisk --zap-all $DISK |
| 8 | |
| 9 | # Clean hdds with dd |
| 10 | dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync |
| 11 | |
| 12 | # Clean disks such as ssd with blkdiscard instead of dd |
| 13 | blkdiscard $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. |
| 17 | ls /dev/mapper/ceph-* | xargs -I% -- dmsetup remove % |
| 18 | |
| 19 | # ceph-volume setup can leave ceph-<UUID> directories in /dev and /dev/mapper (unnecessary clutter) |
| 20 | rm -rf /dev/ceph-* |
| 21 | rm -rf /dev/mapper/ceph--* |
| 22 | |
| 23 | # Inform the OS of partition table changes |
| 24 | partprobe $DISK |