kvm-img info xxx.img
關于格式的優缺點,請參看高級篇
轉換命令(先cd 到你要保存鏡像的位置):
kvm-img convert -f raw -O qcow2 xp.img xp.qco
注意:-O是字母o的大寫。
這條命令舉例的意思是:把名為xp.img格式為raw的鏡像轉換成新鏡像xp.qco格式為qcow2
其它格式"vmdk"是 VMware 3 / 4 兼容鏡像格式。
*******************************深入了解
1.kvm-img 命令
用法:kvm-img 后續命令 [命令選項]
后續命令如下
check [-f fmt] filename
create [-F base_fmt] [-b base_image] [-f fmt] [-o options] filename [size]
commit [-f fmt] filename
convert [-c] [-f fmt] [-O output_fmt] [-o options] [-B output_base_image] filename [filename2 [...]] output_filename
info [-f fmt] filename
snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename
部分內容詳解:
filename
鏡像的文件名(比如:xp.img cat.raw……后綴名隨便取,或者不取)
base_image
只讀的鏡像——有點像“母鏡像”。在“母鏡像”基礎上創建的鏡像只儲存對“母鏡像”的修改。
output_base_image
forces the output image to be created as a copy on write image of
the specified base image; "output_base_image" should have the same
content as the input's base image, however the path, image format,
etc may differ
base_fmt
base_image(母鏡像) 的格式. 參考 fmt
fmt
指鏡像格式。建議大多數情況讓系統自動選擇(不使用該選項)。
主要格式如下:
"raw"
Raw disk image format (默認).該格式精簡,易被多種虛擬機接受。
如果你的系統支持 holes (如 linux 的 ext2 ext3 ext4? windows 的 NTFS),那么它將有效節約空間(比如你創建的磁盤是2G,虛擬系統只使用了800M,那么它實際也只占用800M的空間)。使用命令“kvm-img info 鏡像文件名”,將顯示實際使用的大小。linux用戶還可以使用“ls -ls”命令直接查看。
"qcow2"
QEMU 鏡像格式, 使用最多的格式. 創建的鏡像比較小(用多少就占多少),對于系統文件不支持 holes 的(比如windows系統下使用qemu)很有幫助??蛇M行AES加密,zlib基本壓縮,并支持多種VM的快照(snapshots)。
"qcow"
古老的 QEMU 鏡像格式. Left for compatibility.
"cow"
User Mode Linux Copy On Write image format. Used to be the only
growable image format in QEMU. It is supported only for
compatibility with previous versions. It does not work on
win32.不能運行win32.
"vmdk"
VMware 3 / 4 兼容鏡像格式
"cloop"
Linux Compressed Loop image, useful only to reuse directly
compressed CD-ROM images present for example in the Knoppix CD-
ROMs.
size
鏡像文件的大小比特. 一般單位使 "M" (megabyte, 1024k) 、 "G" (gigabyte, 1024M)、 T (terabyte, 1024G) 。 "b" is ignored.
output_filename
生成的鏡像文件名
output_fmt
生成的鏡像文件格式