On Tue, Sep 28, 2010 at 9:24 PM, Peter Doherty <doherty@xxxxxxxxxxxxxxxxxxx> wrote: > I thought I could do this with the qcow2 images. > I've used: > qemu-img snapshot -c snapname disk_image.qcow2 > to create the snapshot. > > It doesn't work. The snapshots claim to be created, but if I shut down the > guest, apply the snapshot > ( qemu-img snapshot -a snapname disk_image.qcow2 ) > the guest either: > a.) no longer boots (No bootable disk found) > b.) boots, but is just how it was when I shut it down (it hasn't reverted > back to what it was like when the snapshot was made) It is not possible to use qemu-img on the qcow2 image file of a running guest. It might work sometimes but chances are you'll corrupt the image or end up with random behavior. Compare this to mounting a filesystem from the guest and the host at the same time - it is not safe to do this! You can take snapshots using the savevm command inside QEMU but that will pause the guest. If you use a logical volume instead of a qcow2 file then you can create an LVM snapshot. Try to ensure that the guest is in a reasonably idle disk I/O state, otherwise the snapshot may catch the guest at a bad time. On boot up the filesystem may need to perform some recovery (e.g. journal rollback). Live disk snapshots could be supported at the QEMU block layer. Once a snapshot request is issued, all following I/O requests are queued and not started yet. Once existing requests have finished (the block device is quiesced), the snapshot can be taken. When the snapshot completes, the queued requests are started and operation resumes as normal. Qcow2 is unique because it supports "internal" snapshots. Disk snapshots are part of the image file itself and blocks are shared between snapshots using reference counting and copy-on-write. Other image formats only support "external" snapshots via backing files. Examples of this are QCOW1, VMDK, and LVM (using LVM snapshot commands). In order to take an external snapshot you create a new image file that uses the snapshot as a backing file. New writes after the snapshot go to the new file. The old file is the snapshot and should stay unmodified in the future. Stefan -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html