Hits : 2300


based on Kashyap Chamarthy post


- list domains
 
# virsh list
 Id Name                           State
----------------------------------------------------
 1     centos64                       running
 
– managed save of a domain state
 
# virsh managedsave centos64 
Domain centos64 state saved by libvirt
 
# qemu-img snapshot -c snap1 /mnt/backup/VMs/images/centos/6.4/centos64.qcow2
 
 
# qemu-img info /mnt/backup/VMs/images/centos/6.4/centos64.qcow2
image: /mnt/backup/VMs/images/centos/6.4/centos64.qcow2
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 1.7G
cluster_size: 65536
Snapshot list:
ID TAG                 VM SIZE                DATE       VM CLOCK
1         snap1                     0 2013-03-12 10:40:37   00:00:00.000	
 
# qemu-img convert -f qcow2 -O raw -s snap1 /mnt/backup/VMs/images/centos/6.4/centos64.qcow2 snap1-centos64.img
 
# qemu-img info snap1-centos64.img 
image: snap1-centos64.img
file format: raw virtual size: 50G (53687091200 bytes)
disk size: 834M
 
# ls -lash /mnt/backup/VMs/images/centos/6.4/centos64.qcow2 snap1-centos64.img 
1,7G -rw-r--r-- 1 root root 1,7G Μάρ 12 10:40 /mnt/backup/VMs/images/centos/6.4/centos64.qcow2
835M -rw-r--r-- 1 root root  50G Μάρ 12 10:43 snap1-centos64.img
 
 
# qemu-img snapshot -d snap1 /mnt/backup/VMs/images/centos/6.4/centos64.qcow2
 
 
# qemu-img info /mnt/backup/VMs/images/centos/6.4/centos64.qcow2 
image: /mnt/backup/VMs/images/centos/6.4/centos64.qcow2
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 1.7G
cluster_size: 65536
 
 
 
# virsh start centos64
Domain centos64 started