Skip to content

Instantly share code, notes, and snippets.

@linuxkidd
Created March 6, 2015 15:44
Show Gist options
  • Save linuxkidd/0e018546afcfb7ebd2a2 to your computer and use it in GitHub Desktop.
Save linuxkidd/0e018546afcfb7ebd2a2 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo -n "Finding host.. "
remosd=$1
remhost=$(ceph osd find $remosd 2>/dev/null | grep host | awk '{print $4}' | sed -e s/[\",]//g)
if [ "$remhost"x == ""x ]; then
echo Failed: osd.$remosd does not exist.
else
echo $remhost
ssh $remhost -- "echo -n 'Stopping osd.$remosd: '; stop ceph-osd id=$remosd; echo -n 'Removing upstart flag: '; rm -f /var/lib/ceph/osd/ceph-$remosd/upstart; echo done; remdrive=\$(mount | grep \"ceph-$remosd \" | awk '{print \$1}'); echo -n \"Umounting $remdrive: \"; umount \$remdrive; echo done; echo -n \"Removing mount point\"; rmdir /var/lib/ceph/osd/ceph-$remosd; echo done"
echo -n "Removing CRUSH entry for osd.$remosd: "
ceph osd crush remove osd.$remosd
echo -n "Removing OSD entry for osd.$remosd: "
ceph osd rm osd.$remosd
echo -n "Removing Auth for osd.$remosd: "
ceph auth del osd.$remosd
echo Please run 'ceph -w' to monitor for rebalance to complete
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment