qcow二、raw镜像格式

目前主要有那些格式来做为虚拟机的镜像:php

raw
(default) the raw format is a plain binary image of the disc image, and is very portable. On filesystems that support sparse files, images in this format only use the space actually used by the data recorded in them.
老牌的格式,随便dd一个file就模拟了一个raw格式的镜像。目前来看,KVM和XEN默认的格式好像仍是这个格式。由于其原始,有不少原生的特性,例如直接挂载也是一件简单的事情。支持转换成其它格式的虚拟机镜像,空间使用来看,这个很像磁盘,使用多少就是多少(du -h看到的大小就是使用大小),但若是你要把整块磁盘都拿走的话得全盘拿了(copy镜像的时候),会比较消耗网络带宽和I/O。若是那天硬盘不够用了,再买一块盘,能够在原来的盘上追加空间:
dd if=/dev/zero of=zeros.raw bs=1024k count=4096(先建立4G的空间)
cat foresight.img zeros.raw > new-foresight.img(追加到原有的镜像以后)
html

qcow2
QEMU copy-on-write format with a range of special features, including the ability to take multiple snapshots, smaller images on filesystems that don’t support sparse files, optional AES encryption, and optional zlib compression
如今比较主流的一种虚拟化镜像格式,通过一代的优化,目前qcow2的性能上接近raw格式的性能。网络

https://fedoraproject.org/wiki/Features/KVM_qcow2_Performanceapp

对于qcow2的格式,几点仍是比较突出的,qcow2的snapshot,能够在镜像上作N多个快照:性能

  • 更小的存储空间,即便是不支持holes的文件系统也能够(这下du -h和ls -lh看到的就同样了)优化

  • Copy-on-write support, where the image only represents changes made to an underlying disk image(这个特性SUN ZFS表现的淋漓尽致)ui

  • 支持多个snapshot,对历史snapshot进行管理this

  • 支持zlib的磁盘压缩加密

  • 支持AES的加密url

一、KVM中磁盘镜像有哪些格式?kvm从qemu继承了丰富的磁盘格式, 包括裸映象(raw images), 原始qemu格式(qcow), VMware格式和更多二、KVM中raw格式和qcow2格式的比较?kvm虚拟机默认使用raw格式的镜像格式,性能最好,速度最快,它的缺点就是不支持一些新的功能,如支持镜像,zlib磁盘压缩,AES加密等。  要使用镜像功能,磁盘格式必须为qcow2raw格式的话,速度稍微快点,在高版本的qemu-kvm中,几乎不比qcow2的格式快,而qcow2格式节省空间,可动态增加,在公有云中普遍使用,建议使用qcow2

相关文章
相关标签/搜索