KVM 虚拟机备份和还原之二 snapshot
假设已经安装了vm1虚拟机并运行之
创建一个xml文件vm1_snapshot.xml,内容如下:
- <domainsnapshot>
- <name>vm1_snapshot</name>
- <description>Ubuntu 12.10 AMD64 server</description>
- </domainsnapshot>
现在运行下面的命令创建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
- ------------------------------------------------------------
相关推荐
成长路上 2020-07-29
zhangsyi 2020-07-28
82911234 2020-07-20
leeham 2020-07-05
81550996 2020-06-07
leeham 2020-06-06
82143754 2020-05-31
zhangsyi 2020-05-31
82911234 2020-05-31
hnllei 2020-05-30
82911234 2020-05-27
辛佳雨 2020-05-16
82143754 2020-05-15
81550996 2020-05-12
81550996 2020-04-30
82911234 2020-04-29
82143754 2020-04-29
成长路上 2020-04-23