Skip to content

Instantly share code, notes, and snippets.

@enakai00
Created September 1, 2012 22:10
Show Gist options
  • Save enakai00/3589089 to your computer and use it in GitHub Desktop.
Save enakai00/3589089 to your computer and use it in GitHub Desktop.
Remove glusterfs volumes and brick directories.
#!/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