Created
September 1, 2012 22:10
-
-
Save enakai00/3589089 to your computer and use it in GitHub Desktop.
Remove glusterfs volumes and brick directories.
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/sh -x | |
function destroy_vol { | |
vol=$1 | |
brick_del_cmd=$(gluster vol info $vol | awk -F':' '/Brick[0-9]+/ { print "ssh " $2 " rm -rf " $3 ";" }') | |
yes | gluster vol stop $vol | |
yes | gluster vol delete $vol | |
eval $brick_del_cmd | |
} | |
vol=$1 | |
if [[ ! -z $vol ]]; then | |
destroy_vol $vol | |
else | |
for vol in $(gluster vol info | awk -F':' '/Volume Name/ { print $2 }');do | |
destroy_vol $vol | |
done | |
service glusterd restart | |
for node in $(gluster peer status | awk -F':' '/Hostname/ { print $2 }'); do | |
ssh $node service glusterd restart | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment