[libvirt-users] some problem with snapshot by libvirt

Eric Blake eblake at redhat.com
Tue May 29 16:27:02 UTC 2012

On 05/29/2012 10:22 AM, xingxing gao wrote:
> to create snapshot ,I did   step below:
> virsh snapshot-create-as centos snap1 --disk-only --atomic --no-metadata
> virsh snapshot-create-as centos snap2 --disk-only ......
> ........................
> virsh snapshot-creates-as centos snap10 .....
> then i got 10 snapshot of a vm,
> to revert, i just did the follow step:
> 1 destroy centos
> 2 editor="sed -i 's/centosdisk.snap10/centosdisk.snap1/g'" virsh edit centos
> 3 rm -f centos.snap{2,3,4,5,6.....}

Yes, that will be sufficient to revert to the state of the first disk
snapshot, and on booting the 'centos' VM, your domain will have to run
fsck in order to recover to the fact that the file system was not in a
clean state at the time of the snapshot (basically, booting from your
disk snapshot is the same as booting as if you had yanked the power cord).

> 4 start centos
> is these steps correct?
> and another question is ,when i revert to a snapshot,some files of the
> vm's system  missing,does this have any relation with the disk cache
> mode (writeback,writethrough,none,etc.)???how could i avoid that
> happen??

You can install the qemu-ga guest agent in the guest, wire it up in the
host XML describing that guest, and add the --quiesce option to your
snapshot-create-as command in an effort to have the guest freeze file
systems before taking the snapshot.  The end result will be that the
file system is in a sane state (as if you had cleanly shut down), rather
than in an incomplete state (as if you had yanked the power cord).

I know that qemu-ga is available as part of the latest Fedora package,
and that it was designed to be compiled for older Linux and also for
Windows guests, although I don't personally have a good pointer for
where to get the best version of qemu-ga for your specific guests.
Maybe others can chime in here.

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120529/5d34276e/attachment.sig>

More information about the libvirt-users mailing list