假设已经安装了vm1虚拟机并运行之
创建一个xml文件vm1_snapshot.xml,内容如下:
现在运行下面的命令创建vm1的snapshot:
virsh snapshot-create vm1 ./vm1_snapshot.xml
Domain snapshot vm1_snapshot created from './vm1_snapshot.xml'
现在检查一下vm1的snapshot
virsh snapshot-list vm1
Name Creation Time State
------------------------------------------------------------
vm1_snapshot 2012-11-14 14:46:44 +0800 running
现在先登录正在运行的vm1,在/root/下添加一个文件
touch xy
好,用vm1_snapshot来替代现在的vm1(或者说将vm1还原到vm1_snapshot保存的状态)
virsh snapshot-revert vm1 vm1_snapshot
再次登录vm1, /root下没有了xy文件。还原成功。
如果不需要这个vm1_snapshot,可以用下面的命令删除之:
virsh snapshot-delete vm1 vm1_snapshot
Domain snapshot vm1_snapshot deleted
root@host2:~/kvm# virsh snapshot-list vm1
Name Creation Time State
------------------------------------------------------------