Efficient live disk backup with active blockcommit
列出当前正在使用的block device
$ virsh domblklist vm1 Target Source ------------------------------------------------ vda /export/images/base.qcow2
创建一个external disk snapshot
$ virsh snapshot-create-as --domain vm1 sn1 \ --diskspec vda,file=/export/images/sn1.qcow2 \ --disk-only --atomic
现在disk image chain为:
[base] <-- [sn1] (live QEMU)
NOTE-1:如果guest中安装有QEMU guest agent,可以'--quiesce' option来得到consistent disk state
备份origin disk:
$ cp /export/images/base.img /export/images/copy.img [or] $ rsync -avh --progress /export/images/base.img \ /export/images/copy.img
再看当前正在使用的block device为sn1:
$ virsh domblklist vm1 Target Source ------------------------------------------------ vda /export/images/sn1.qcow2
执行blockcommit:
$ virsh blockcommit vm1 vda --active --verbose --pivot
再看当前正在使用的block device为origin disk:
$ virsh domblklist vm1 Target Source ------------------------------------------------ vda /export/images/base.qcow2
disk image chain:
[base] (live QEMU)
http://wiki.libvirt.org/page/Live-disk-backup-with-active-blockcommit