Ceph RBD Online Resize

laurentbarbe

Extend rbd drive with libvirt and XFS

First, resize the device on the physical host.

Get the current size :

1
$ qemu-img info -f rbd "rbd:rbd/myrbd"

Be careful, you must specify a bigger size, shrink a volume is destructive for the FS.

1
$ qemu-img resize -f rbd "rbd:rbd/myrbd" 600G

List device define for myVM :

1
$ virsh domblklist myVM

Resize libvirt blockdevice :

1
2
$ virsh blockresize --domain myVM --path vdb --size 600G
$ rbd info rbd/myrb

Extend xfs on guest :

1
$ xfs_growfs /mnt/rbd/myrbd

Extend rbd with kernel module

You need at least kernel 3.10 on ceph client to support resizing. For previous version look at http://dachary.org/?p=2179

Get current size :

1
$ rbd info rbd/myrbd

Just do :

1
2
$ rbd resize rbd/myrbd --size 600000
$ xfs_growfs /mnt/rbd/myrbd

Also, since cuttlefish you can’t shrink a bloc device without specify additional option (–allow-shrink)