Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# wv@linux.com
echo "Real size of a Ceph RBD images"
echo
date
ceph -s | head -1 | sed "s/ //g" && ceph --version
echo
totalimages=0
for pool in $(ceph osd pool ls);do
for image in $(rbd -p $pool ls);do
size=$(rbd diff ${pool}/${image} | awk '{ SUM += $2 } END { print SUM/1024/1024 }')
if [ $size != 0 ];then totales=(${totales[@]} $(echo $size));fi
echo "${pool}/${image} ${size} MB"
totalimages=$[$totalimages +1]
done
done
total=$(echo ${totales[@]} | sed "s/ /\n/g" | awk '{ SUM += $1 } END { print SUM " MB" }')
echo
echo "Found: $totalimages RBD images"
echo "Total Used: ${total}"
@bvera

This comment has been minimized.

Show comment
Hide comment
@bvera

bvera Aug 18, 2016

SES: Ceph real size of RBD images
Another dirty script

http://nubla.do/ses-rbdrealsize/

William Vera
wv@linux.com

Owner

bvera commented Aug 18, 2016

SES: Ceph real size of RBD images
Another dirty script

http://nubla.do/ses-rbdrealsize/

William Vera
wv@linux.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment