Last active
August 8, 2019 13:01
-
-
Save linuxkidd/b54935324cc86be63db5a1e8628d8dad to your computer and use it in GitHub Desktop.
Mark each OSD down in a Ceph cluster, waiting for previous OSD to come up before downing the next.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| totalosds=$(ceph osd tree | grep -c osd\\.[0-9][0-9]*.*up) | |
| osdcounter=1 | |
| for i in $(ceph osd tree | awk '/up/ {split($3,a,".");print a[2]}');do | |
| echo -n "Currently at: $osdcounter / $totalosds == " | |
| echo "scale=2; $osdcounter/$totalosds*100" | bc | |
| isup=$(ceph osd dump | grep -c osd\\.$i\ up) | |
| if [ $isup -eq 1 ]; then | |
| ceph osd down osd.$i | |
| while [ $(ceph osd dump | grep -c osd\\.$i\ up) -eq 0 ];do | |
| echo -n . | |
| sleep 1 | |
| done | |
| echo | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment