Convert RBD to Format V2

syndicated

Simple Import / Export

Don’t forget to stop IO before sync and unmap rbd before rename.

1
2
3
$ rbd export rbd/myrbd - | rbd import --image-format 2 - rbd/myrbd_v2
$ rbd mv rbd/myrbd rbd/myrbd_old
$ rbd mv rbd/myrbd_v2 rbd/myrbd

Check :

1
2
3
4
5
6
7
$ rbd info rbd/myrbd
$ rbd image 'myrbd':
  size 102400 KB in 25 objects
  order 22 (4096 KB objects)
  block_name_prefix: rbd_data.24f72ae8944a
  format: 2
  features: layering

Using DIFF

For the first sync, you don’t need to stop IO on device. Make snap, and sync until this snapshot.

1
2
3
$ rbd snap create rbd/myrbd@snap1
$ rbd export rbd/myrbd@snap1 - | rbd import --image-format 2 - rbd/myrbd_v2
$ rbd snap create rbd/myrbd_v2@snap1

Check snapshot :

1
$ rbd snap ls rbd/myrbd_v2

Sync diff : Stop IO before last sync

1
2
$ rbd snap create rbd/myrbd@snap2
$ rbd export-diff --from-snap snap1 rbd/myrbd@snap2 - | rbd import-diff - rbd/myrbd_v2