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

相關文章
相關標籤/搜索