Windows平台的qemu-img(免费开源),它可用于转换,创建和一致性检查各种虚拟磁盘格式。兼容Hyper-V,KVM,VMware,VirtualBox和Xen虚拟化解决方案。此版本已针对Windows Server(x64)进行了优化,包括Windows Nano Server。
支持的格式
Image format | Argument for -f and -O options |
---|---|
VMDK (VMware) | vmdk |
QCOW2 (KVM, Xen) | qcow2 |
VHD (Hyper-V) | vpc |
VHDX (Hyper-V) | vhdx |
RAW | raw |
VDI (VirtualBox) | vdi |
使用示例:
将相同目录中的Hyperv-VHDX文件转换成KVM的qcow2,下载软件,解压到任意目录,打开cmd或者powershell:
.\qemu-img.exe convert -O qcow2 .\WinSrv12R2.vhdx .\WinSrv12R2.qcow2
转换一个 QCOW2, RAW, VMDK or VDI image 到 VHDX
qemu-img.exe convert source.img -O vhdx -o subformat=dynamic dest.vhdx
转换到VHD:
qemu-img.exe convert source.img -O vpc -o subformat=dynamic dest.vhd
如果报错:

你需要执行一致性检查
qemu-img.exe check -r all WinSrv12R2.vhdx
对于VHD(vpc)或VHDX,子格式可以是“dynamic”或“fixed”。
更多参数,使用:qemu-img.exe -h
官网地址:https://cloudbase.it/qemu-img-windows/
PS.不要在磁盘文件使用过程中进行操作,会导致数据不一致,必须离线使用