kvm快照應用
kvm也具有快速恢復的方法,前提是必須處於關機狀態纔可以執行,否則會出現各種莫名其妙的問題
創建鏡像:
qemu-img snapshot -c initial smokeping_falcon_test0917.qcow2
恢復鏡像:
qemu-img snapshot -a initial smokeping_falcon_test0917.qcow2
刪除鏡像
qemu-img snapshot -d initial smokeping_falcon_test0917.qcow2
狀態查看
qemu-img snapshot -l smokeping_falcon_test0917.qcow2
創建前的大小
[root@smokeping]# ll
total 7578488
-rw-r--r-- 1 root root 171825168384 Sep 17 17:01 smokeping_falcon_test0917.xml
-rw-r--r-- 1 root root 171825168384 Sep 17 16:01 smokeping_falcon_test_187.qcow2
-rw-r--r-- 1 root root 171825168384 Sep 6 11:14 smokeping_falcon_test.qcow2
以下是創建後的文件
[root@smokeping]# ll
total 7603284
-rw-r--r-- 1 qemu qemu 171850530816 Sep 17 17:22 smokeping_falcon_test0917.qcow2
-rw-r--r-- 1 root root 171825168384 Sep 17 16:01 smokeping_falcon_test_187.qcow2
-rw-r--r-- 1 root root 171825168384 Sep 6 11:14 smokeping_falcon_test.qcow2
查看鏡像方法1
[root@smokeping]# qemu-img info smokeping_falcon_test0917.qcow2
image: smokeping_falcon_test0917.qcow2
file format: qcow2
virtual size: 160G (171798691840 bytes)
disk size: 2.2G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 initial 0 2012-09-17 17:08:49 00:00:00.000
查看鏡像方法2
[root@smokeping]# qemu-img snapshot -l smokeping_falcon_test0917.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 initial 0 2012-09-17 17:08:49 00:00:00.000
利用這個鏡像,可以迅速還原服務器狀態,使用空間也不大。
實測中,若虛擬機爲啓動狀態製作快照,恢復後會無法載入系統,關閉服務器,再次啓動,服務器直接崩潰。