[root@WWW.ESOJOURN.ORG vps]# qemu-img info centos1.img
image: centos1.img
file format: raw
virtual size: 200G (214748364800 bytes)
disk size: 6.5G
RAW格式是最原始的镜像格式,好处是速度快。但不支持很多新的功能。现在qcow2格式效率有很大提升了,而且还支持一些新的功能 1 更小的存储空间,即使是不支持holes的文件系统也可以(这下du -h和ls -lh看到的就一样了) 2 Copy-on-write support, where the image only represents changes made to an underlying disk image(这个特性SUN ZFS表现的淋漓尽致) 3 支持多个snapshot,对历史snapshot进行管理 4 支持zlib的磁盘压缩 5 支持AES的加密
Also, discussed with Eric, in what cases does virsh invoke Qemu’s ‘savevm‘ and ‘qemu-img snapshot -c‘ commands while creating different types of snapshots discussed earlier above. Here is the outline:
- it uses ‘qemu-img snapshot -c‘ if the domain is offline and –disk-only was not specified
- it uses qemu’s ‘savevm‘ if the domain is online and –disk-only was not specified
- it uses qemu’s ‘snapshot_blkdev‘ if the domain is online and –disk-only is specified
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snap1 0 2011-07-21 23:17:38 00:00:00.000
恢复快照:
qemu-img snapshot -a CentOS5.5_64bit_Qcow2_basesys.img CentOS5.5_64bit_Qcow2.img
其他操作:
'snapshot' is the name of the snapshot to create, apply or delete
'-a' applies a snapshot (revert disk to saved state)
'-c' creates a snapshot
'-d' deletes a snapshot
'-l' lists all snapshots in the given image
CentOS 6 KVM Snapshot
確認 VM Image 格式
執行 snapshot 的語法
virsh snapshot-create vmname
範例:
[root@asus-ts100e7 ~]# virsh snapshot-create e-plast-mail
錯誤:Requested operation is not valid: Disk '/var/lib/libvirt/images/e-plast-mail.img' does not support snapshotting
要能執行 snapshot 的 VM image 必須是 qcow2 的格式, 出現這樣的訊息, 就要去確認與轉換.
確認 image 的格式語法
qemu-img info yourdisk.img
範例:
[root@asus-ts100e7 ~]# qemu-img info /var/lib/libvirt/images/e-plast-mail.img
image: /var/lib/libvirt/images/e-plast-mail.img
file format: raw
virtual size: 9.8G (10485760000 bytes)
disk size: 9.8G
如果是 raw 要先轉成 qcow2 格式, 語法
qemu-img convert -f raw -O qcow2 yourdisk.img newdisk.qcow2
範例:
[root@asus-ts100e7 ~]# qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/e-plast-mail.img /var/lib/libvirt/images/e-plast-mail.qcow2
[root@asus-ts100e7 ~]# qemu-img info /var/lib/libvirt/images/e-plast-mail.qcow2
image: /var/lib/libvirt/images/e-plast-mail.qcow2
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 3.0G
cluster_size: 65536
更改 vm config file 範例:
virsh edit e-plast-mail
:
:
重新啟動 vm 範例:
virsh restart e-plast-mail
建立 snapshot
目前版本進行 snapshot 過程 vm 會無法運作
執行 snapshot 的語法
virsh snapshot-create vmname
範例:
[root@asus-ts100e7 ~]# virsh snapshot-create e-plast-mail
Domain snapshot 1349058343 created
[root@desktop2 ~]# cat /proc/version Linux version 2.6.32-220.el6.x86_64 (mockbuild@x86-004.build.bos.redhat.com) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Wed Nov 9 08:03:13 EST 2011 [root@desktop2 ~]#
Create the Google Play Account
Having a Google account, pay 25$, then you get your google developer account.
References:
http://developer.android.com/distribute/googleplay/start.html
https://p