fedora 18 KVM在线快照功能体验


fedora 18 KVM在线快照功能体验
 
fedora 18发布了,虚拟化方面最激动人心的一个功能就是在线快照。
以前KVM要做快照,虚拟机会自动暂停,现在终于克服这个问题了。
   www.2cto.com  
实验环境:
硬件 Intel(R) Xeon(R) CPU  E5540  @ 2.53GHz  6G内存 80G sata硬盘
软件 fedora 18 kernel 3.7.2-204.fc18.x86_64
 
目前virt-manager 还不支持做快照,只能通过virsh的命令行操作。在线快照只支持磁盘是raw和qcow2格式的虚拟机。
测试的时候,创建两个虚拟机,w和test1,w磁盘是raw格式的,test1磁盘是qcow2格式的,通过如下命令创建快照,并一直ping虚拟机,可以看到,快照在一瞬间生成,并且虚拟机没有丢包。
 
virsh snapshot-create-as w snapshot1 "snapshot1 description" --disk-only –atomic
virsh snapshot-create-as test1 snapshot1 "snapshot1 description" --disk-only --atomic
 
创建的快照和虚拟机磁盘镜像文件在一起,并且快照都是qcow2格式的。
[root@localhost datapool]# ls
test01.qcow2  test01.snapshot1
[root@localhost datapool]# qemu-img info test01.snapshot1
image: test01.snapshot1
file format: qcow2
virtual size: 60G (64424509440 bytes)
disk size: 516K
cluster_size: 65536
backing file: /datapool/test01.qcow2
 
 
[root@localhost images]# qemu-img info w.snapshot1
image: w.snapshot1
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 6.6M
cluster_size: 65536
backing file: /var/lib/libvirt/images/w.img
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         snapshot2              6.3M 2013-01-22 14:29:06   00:59:59.854
[root@localhost images]# qemu-img info w.img
image: w.img
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: 0
[root@localhost images]#
 
常用命令:  www.2cto.com  
 
列出虚拟机快照
virsh # snapshot-list w
 名称               Creation Time             状态
------------------------------------------------------------
 snapshot1            2013-01-22 13:29:32 +0800 disk-snapshot
 snapshot2            2013-01-22 14:29:06 +0800 running
 
倒退虚拟机到上一个快照
virsh  snapshot-revert w snapshot2
 
将虚拟机的镜像变化,合并到快照
virsh blockpull --domain w --path /var/lib/libvirt/images/w.snapshot1
删除快照
virsh snapshot-delete w snapshot2
 

相关内容

    暂无相关文章