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
qemu-img snapshot -c snap1 centos1-qcow2.img
qemu-img snapshot -l centos1-qcow2.img
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
[emot]zan[/emot]