Hi, all
I recently started looking into how to create incremental backups using
Libvirt+Qemu. I have already found that, since Libvirt 7.6.0, we can use
the virDomainBackupBegin API to create incremental backups of live VMs
through Libvirt. Using this API we can back up the VM's disks and create
a checkpoint at the same time. After the first full backup, we can
create incremental backups referencing the checkpoint that was generated
on the previous backup process.
As far as I understood Libvirt's documentation, when using this API to
create a checkpoint, what happens is that Libvirt will create a new
bitmap on the VM's disk to track the changes that happened from that
checkpoint on, then, they'll copy what changed between the last bitmap
and the new one. By doing this, Libvirt is able to create incremental
backups of disks that are used by running VMs.
My problem is the following though: after I stop the VM, I'm no longer
able to use Libvirts API as it requires the VM (domain) to be running.
However, there might still be changes on the disk since the last backup
I performed. Therefore, to create a backup of the changes made since the
last backup until the VM was stopped, I have to work directly on the VM
image using Qemu. I have checked, and the QCOW2 file has the checkpoint
created with the Libvirt backup process (I checked via the "qemu-img
info"). Therefore, we have the marker of the last checkpoint generated
by the last backup process. However, if the VM is stopped, there is no
clear way to export this last differencial copy of the volume.
I have searched through the documentation about this; however, I haven't
found any example or explanation on how to manually export a
differencial copy of the QCOW2 file using the last checkpoint (bitmap)
created.
I would much appreaciate, if people could point me to the direction on
how to export differencial copies of a QCOW2 file, using the checkpoints
(bitmaps) that it has.
Thank you guys in advance!