Hits : 2471


This note page is in GReek


Case A


internal snapshots


Χρειάζεται το image format της εικονικής μηχανής, να είναι qcow2
Το qcow2 σημαίνει: Qemu Copy On Write v2
και υποστηρίζει snapshots.


# virsh start test
Domain test started
 
# virsh snapshot-create-as test
Domain snapshot 1363290212 created
 
# virsh snapshot-list  test
 Name                 Creation Time             State
------------------------------------------------------------
 1363290212           2013-03-14 21:43:32 +0200 running
 
# virsh snapshot-create-as test
 
Domain snapshot 1363291168 created
 
# virsh snapshot-list  test
 Name                 Creation Time             State
------------------------------------------------------------
 1363290212           2013-03-14 21:43:32 +0200 running
 1363291168           2013-03-14 21:59:28 +0200 running

libvirtd


# pwd -P
/var/lib/libvirt/qemu/snapshot/test
 
# ls -l
total 16
-rw------- 1 root root 4242 Μάρ 14 21:59 1363290212.xml
-rw------- 1 root root 4293 Μάρ 14 22:04 1363291168.xml

Πάντα εργαζόμαστε στο τελευταίο running snapshot και κρατάει εσωτερικά (δλδ μέσα στον δίσκο) τα snapshots


# qemu-img info test.qcow2 
image: test.qcow2
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.3G
cluster_size: 65536
Snapshot list:
ID TAG                 VM SIZE                DATE       VM CLOCK
1         1363290212             196M 2013-03-14 21:43:32   00:01:02.984
 
 
# qemu-img info test.qcow2 
image: test.qcow2
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.6G
cluster_size: 65536
Snapshot list:
ID TAG                 VM SIZE                DATE       VM CLOCK
1         1363290212             196M 2013-03-14 21:43:32   00:01:02.984
2         1363291168             268M 2013-03-14 21:59:28   00:16:49.119

Πως επιστρέφουμε στο αρχικό image


# virsh snapshot-delete test 1363291168 
Domain snapshot 1363291168 deleted
 
# qemu-img info test.qcow2 
image: test.qcow2
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.8G
cluster_size: 65536
Snapshot list:
ID TAG                 VM SIZE                DATE       VM CLOCK
1         1363290212             196M 2013-03-14 21:43:32   00:01:02.984
 
# virsh snapshot-delete test 1363290212 
Domain snapshot 1363290212 deleted
 
# qemu-img info test.qcow2 
image: test.qcow2
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.8G
cluster_size: 65536

Case B


# qemu-img info winxp.img.spars
image: winxp.img.spars
file format: raw virtual size: 5.0G (5368709120 bytes)
disk size: 5.0G
 
# ls -l winxp.img.spars
-rw-r--r-- 1 ebal ebal 5368709120 Μάρ 15 12:30 winxp.img.spars
 
# qemu-img convert -p -f raw -O qcow2 winxp.img.spars winxp.qcow2
 
# lrzip winxp.qcow2.spars
Output filename is: winxp.qcow2.spars.lrz
winxp.qcow2.spars – Compression Ratio: 2.235. Average Compression Speed:  6.677MB/s.
Total time: 00:06:08.76
 
# ls -l
σύνολο 3642396
-rw-r--r-- 1 root root 2576809984 Μάρ 15 13:33 winxp.qcow2.spars
-rw-r--r-- 1 root root 1153117496 Μάρ 15 13:46 winxp.qcow2.spars.lrz
 
# qemu-img info winxp.qcow2.spars
image: winxp.qcow2.spars
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 2.4G
cluster_size: 65536
 
# virsh snapshot-create-as test 
Domain snapshot 1363348525 created
 
# virsh snapshot-list test
 Name                 Creation Time             State
------------------------------------------------------------
 1363348525           2013-03-15 13:55:25 +0200 running
 
# qemu-img info winxp.qcow2.spars
image: winxp.qcow2.spars
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 2.7G
cluster_size: 65536
Snapshot list:
ID TAG                 VM SIZE                DATE       VM CLOCK
1         1363348525             254M 2013-03-15 13:55:25   00:01:41.575
 
# virsh snapshot-delete test 1363348525
Domain snapshot 1363348525 deleted
 
# qemu-img info winxp.qcow2.spars
image: winxp.qcow2.spars
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 2.7G
cluster_size: 65536