I implemented a bash script which is backing up my VMs. Basically I am doing the following steps:

  1. Create a snapshot of the target VM
  2. Backup the disk of the target VM
  3. Merge the changes back to the disk

Now I tested the backups and noticed, that the disks of the machines are not fully consistent. The Windows machine is starting with a chkdisk and recovers some files. I understand that this is especially the case, if step 1 happens during a write.

However, all backups done so far, are booting but I am afraid that there are cases where the backup won't boot.

I am especially worried about the windows machines.

Are these worries justified?

Thank you in advance!


To make sure your backups are consistent, you need to tell the VM to put the filesystem into a consistent (quiesced) state. On both Linux and Windows this requires some support for quiescing the filesystem, and this is provided by the qemu guest agent.

Make sure have the qemu guest agent running in each VM. Then, take your snapshot by adding --quiesce to the snapshot command, i.e.:

virsh snapshot-create --quiesce <domain>

You can also freeze and thaw the filesystem manually, without necessarily taking a snapshot, with virsh domfsfreeze and virsh domfsthaw. Use these if you are taking snapshots outside of libvirt, e.g. with ZFS or with SAN storage.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.