Real size of a Ceph RBD image
RBD images are thin-provisionned thus you don’t always know the real size of the image. Moreover, Ceph doesn’t provide any simple facility to check the real size of an image. This blog post took his inspiration from the Ceph mailing list.
Create an image:
$ rbd create -s 1024 toto |
The magic formula using block differential:
$ rbd diff rbd/toto | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }' |
Further testing:
$ rbd map toto |
So we wrote 10M, we should get 10MB in the ouput :).
$ rbd diff rbd/toto | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }' |
Thanks to Olivier Bonvalet for the AWK command.
Comments