Skip to content

create zap-disk command for disk cleanup without going to the node #426

@ideepika

Description

@ideepika

we can add some checks for if the disk doesn't have preexisting ceph mappers, dont zap it, or can extend the purge-osd command to zap as well in the same operation.

this can be done with the help of debug-node

DISK=${1:-"/dev/sdX"}
NODE=${2:?"Node required if targeting remote"}

# Debug node via kubectl-debug (your prior pattern) [cite:30]
kubectl debug node/$NODE -it --image=ubuntu --share=true -- bash -c "
  apt update && apt install -y sgdisk parted util-linux blkdiscard;
  sgdisk --zap-all $DISK;
  dd if=/dev/zero of='$DISK' bs=1M count=100 oflag=direct,dsync;
  blkdiscard \$DISK 2>/dev/null || true;
  partprobe $DISK;
  echo 'Disk $DISK zapped successfully';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions