Skip to content

Instantly share code, notes, and snippets.

@cwilkers
Created August 8, 2024 15:30
Show Gist options
  • Save cwilkers/9bd927bf8bea3c9f9856a079b070081b to your computer and use it in GitHub Desktop.
Save cwilkers/9bd927bf8bea3c9f9856a079b070081b to your computer and use it in GitHub Desktop.
Clear old data on PVs for ODF after reinstalling
#!/bin/bash
for pod in $(oc -n openshift-storage get pod -l app=rook-ceph-osd-prepare -o name)
do
DISK=$(oc -n openshift-storage get $pod -oyaml | grep -A1 ROOK_DATA_DEVICES | awk -F'"' '/value/ {print $4}')
oc -n openshift-storage debug $pod -- bash -c "sgdisk --zap-all $DISK; dd if=/dev/zero of=$DISK bs=1M count=100 oflag=direct,dsync"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment