KVM虚拟机的快照:通过在虚拟机磁盘镜像内保存不同时间点的状态数据实现备份,在必要时可将虚拟机恢复到指定的快照状态。
qemu-img快照管理基本操作: 创建快照:qemu-img snapshot -c 快照名 qcow2磁盘 列出快照:qemu-img snapshot -l qcow2磁盘 恢复快照:qemu-img snapshot -a 快照名 qcow2磁盘 删除快照:qemu-img snapshot -d 快照名 qcow2磁盘
1.确保虚拟机rhel-7已经关机
[root@kvmsvr ~]# virsh list --all | grep rhel-7
- rhel-7 shut off
2.为虚拟机rhel-7的磁盘制作快照
[root@kvmsvr ~]# cd /var/lib/libvirt/images/
[root@kvmsvr images]# qemu-img snapshot -c snap1 rhel-7.qcow2 //制作快照
[root@kvmsvr images]# qemu-img snapshot -l rhel-7.qcow2 //列出快照
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snap1 0 2017-01-05 15:44:25 00:00:00.000
1.启动虚拟机rhel-7
[root@kvmsvr ~]# virsh start rhel-7
Domain rhel-7 started
2.正常登入虚拟机rhel-7,在桌面建立文件1.txt
1.关闭虚拟机rhel-7
[root@kvmsvr ~]# virsh destroy rhel-7Domain rhel-7 destroyed
2.将虚拟机rhel-7的磁盘还原到快照snap1
[root@kvmsvr images]# qemu-img snapshot -a snap1 rhel-7.qcow2
3.重新开启虚拟机rhel-7
[root@kvmsvr ~]# virsh start rhel-7Domain rhel-7 started
4.正常登入虚拟机rhel-7,检查桌面的文件1.txt
因为此文件是在建快照之后才建立的,所以还原快照以后就没有了。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有