24 lines
803 B
Bash
Executable File
24 lines
803 B
Bash
Executable File
#!/usr/bin/env bash
|
|
DISK="/dev/vdc" #按需修改自己的盘符信息
|
|
|
|
# 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 and /dev/mapper (unnecessary clutter)
|
|
rm -rf /dev/ceph-*
|
|
rm -rf /dev/mapper/ceph--*
|
|
|
|
# Inform the OS of partition table changes
|
|
partprobe $DISK |