On Fri, Oct 10, 2014 at 07:32:06PM -0600, Eric Blake wrote:
On 10/10/2014 11:37 AM, Jd wrote:
> Hi
> Looking in to implementing (CBT like) delta backup for KVM.
Not quite sure what you mean by CBT.
>
> The following looks promising..(last paragraph)
>
http://wiki.qemu.org/Features/Snapshots2
>
Libvirt hasn't yet been patched to take advantage of all the latest qemu
features. Patches are welcome. But libvirt already knows how to create
external snapshots and do blockpull (backing files pulled into the
active image so the backing isn't needed any more) and commit (active
files pushed into the backing files), and even though it is not as
full-featured as where we'd like to get, it can already do quite a bit.
To expand an example of what Eric wrote here about external snapshots,
some commands to try:
1. Check the current acitve disk image in use:
$ virsh domblklist vm1
2. Create an external live snapshot:
$ virsh snapshot-create-as --domain vm1 sn1 \
--diskspec vda,file=/export/images/sn1.qcow2 \
--disk-only --atomic --no-metadata
Note (thanks Eric Blake): Above, if you have QEMU guest agent
installed in your virtual machine, try --quiesce option with
'snapshot-create-as' to ensure you have a consistent disk state.
Now, you have a disk image chain:
base <-sn1 (live QEMU)
3. Take a backup of the original disk in backround:
$ rsync -avh --progress /export/images/base.img \
/export/images/copy.img
4. Commit the sn1 contents back into base:
$ virsh blockcommit vm1 vda --active --verbose --pivot
Now, the chain is:
base (live QEMU)
with contents from sn1 live committed into base.
5. Check the current acitve disk image in use again:
$ virsh domblklist vm1
--
/kashyap