Qemu qmp snaphot-drive

Husain Bhala asked:

what is the correct method to use qemu qmp snapshot-drive ?

Is there any other way to create snapshot of qcow2 based VPS without using virsh snapshot-create ? They seem to corrupt the filesystem on VPS.

My answer:

To get a consistent filesystem snapshot, you need all of the following:

  1. The qemu-guest-agent must be installed and running in the guest.
  2. Run virsh domfsfreeze guestname before taking the snapshot. This tells the qemu-guest-agent to stop all filesystem activity and bring it to a consistent state.
  3. Take your snapshot.
  4. Run virsh domfsthaw guestname after taking the snapshot. This tells the qemu-guest-agent to allow filesystem activity to resume. But the snapshot will remain as it was when frozen above.
  5. Back up the snapshot.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.