第一步,解压缩ova,提取其中的vmdk
第二步, 从https://www.qemu.org/download/ 下载qemu工具。我下载的是windows版本。
第三步,安装之后,执行命令如下:
qemu-img.exe convert -O qcow2 your-vmdk-file the-target-qcow2-file-name.qcow2
文件比较大的,需要慢慢等待。 转成qcow2之后,文件大小会翻倍。下面是转换前后的文件大小的比较。
ova转qcow2
主要步骤如下:
- 解压OVA文件,获取*.vmdk文件;
- 将*.vmdk文件转换为qcow2文件;
1. 解压ova文件
解压出来一共三个文件,其中.vmdk文件就是我们需要的硬盘文件:
example.ovfexample-disk1.vmdk example.mf
2. 用命令将vmdk文件转化为qcow2文件
- qemu-img convert -c -f vmdk -O qcow2 example-disk1.vmdk example.qcow2
指令说明:
-c:标识目标image必须是压缩的(qcow format only);-f:first image format-O:output_format
参考: https://edoceo.com/notabene/ova-to-vmdk-to-qcow2
[size=1.5]The OVA file is nothing more than a TAR archive, containing the .OVF and .VMDK files. Easy! [size=1.5]Using Evergreen ILS for example: ~ $ file Evergreen_trunk_Squeeze.ovaEvergreen_trunk_Squeeze.ova: POSIX tar archive (GNU)[size=1.5]I'ts possible to use the tar command to list the contents ~ $ tar -tf Evergreen_trunk_Squeeze.ova Evergreen_trunk_Squeeze.ovfEvergreen_trunk_Squeeze-disk1.vmdk[size=1.5]Simply extract those things... ~ $ tar -xvf Evergreen_trunk_Squeeze.ovaEvergreen_trunk_Squeeze.ovfEvergreen_trunk_Squeeze-disk1.vmdk[size=1.5]Now take a look at the created files The OVF XML file describes the image, it makes for some interesting reading about the expectations of the running environment. ~ $ file Evergreen_trunk_Squeeze*Evergreen_trunk_Squeeze-disk1.vmdk: VMware4 disk imageEvergreen_trunk_Squeeze.ova: POSIX tar archive (GNU)Evergreen_trunk_Squeeze.ovf: XML document text[size=1.5]Recent versions of qemu are able to run directly from the VMDK file, buy why do that? Use QCOW2, it's better. Execute: qemu-img -h and the last line of output shows the supported formats. ~ $ qemu-img -h |tail -n1Supported formats: raw cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd blkdebug sheepdog host_cdrom host_floppy host_device file[size=1.5]Now actually convert it, this may take some time. ~ $ qemu-img convert -O qcow2 Evergreen_trunk_Squeeze-disk1.vmdk Evergreen_trunk_Squeeze.qcow2Contents of OVF Files[size=1.5]The OVA is intended to run an Appliance and this OVF file describes the appliance. Examine the contents of this file to determine information about the expected CPU, Memory and other appliance details. These will be important to getting the image to run under KVM. Noteably, Windows has a terrible time moving, ensure you have the MergeIDE fix in place.
|