You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从macOS复制到Windows的s390x架构Qemu qcow2镜像无法识别

QEMU s390x镜像在Windows启动报错:Image is not in qcow2 format

问题描述

在arm64架构的macOS系统使用QEMU 9.0.2时,riscv64、ppc64、s390x三种架构的qcow2格式虚拟机镜像均可正常运行。将所有文件复制到x64架构的Windows 11系统(QEMU v9.1.0-rc2)后,riscv64和ppc64架构的虚拟机可通过原命令正常启动,但s390x架构的qemu-system-s390x执行失败,报错“Image is not in qcow2 format”。

补充验证信息

  • macOS与Windows上的s390x镜像文件完全一致,sha256sum校验值相同
  • 镜像复制方式对riscv64和ppc64架构有效,仅s390x出现问题
  • Windows系统上qemu-img可正确识别该s390x镜像为qcow2格式,输出信息如下:
$ qemu-img info disk.qcow2
image: disk.qcow2
file format: qcow2
virtual size: 30 GiB (32212254720 bytes)
disk size: 16 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
Child node '/file':
    filename: disk.qcow2
    protocol type: file
    file length: 16 GiB (17141137408 bytes)
    disk size: 16 GiB
  • 报错发生在启动Guest OS之前,与Guest OS无关(s390x使用Ubuntu 24.04)

原QEMU启动命令

三个架构的启动命令在macOS与Windows上完全一致:

# riscv64
qemu-system-riscv64 -machine virt -smp 8 -m 8192 -nographic \
    -bios fw_jump.bin -kernel u-boot.bin \
    -device virtio-net-device,netdev=net \
    -netdev user,id=net,hostfwd=tcp::2233-:22 \
    -drive file=disk.qcow2,format=qcow2,if=virtio \
    -device virtio-rng-pci

# ppc64
qemu-system-ppc64 -smp 8 -m 8192 -nographic \
    -drive file=disk.qcow2,format=qcow2 \
    -nic user,hostfwd=tcp::2299-:22

# s390x
qemu-system-s390x -machine s390-ccw-virtio -cpu max,zpci=on -smp 8 -m 8192 -nographic \
    -drive file=disk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none \
    -device virtio-blk-ccw,devno=fe.0.0002,drive=drive-virtio-disk0,bootindex=1 \
    -nic user,hostfwd=tcp::2288-:22

Windows上s390x的具体报错

$ qemu-system-s390x -machine s390-ccw-virtio -cpu max,zpci=on -smp 8 -m 8192 -nographic \
    -drive file=disk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none \
    -device virtio-blk-ccw,devno=fe.0.0002,drive=drive-virtio-disk0,bootindex=1 \
    -nic user,hostfwd=tcp::2288-:22
C:\Program Files\qemu\qemu-system-s390x.exe: -drive file=disk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Image is not in qcow2 format

原因分析

  1. QEMU版本兼容性问题:Windows上使用的是QEMU 9.1.0-rc2预发布版本,可能存在s390x架构下qcow2镜像校验逻辑的bug。qemu-img和qemu-system-s390x对镜像格式的校验路径不同,导致前者识别正常但后者报错。
  2. compat参数适配问题:镜像的compat版本为1.1,Windows平台的s390x驱动可能对该版本的qcow2支持存在兼容性缺陷。

解决方法

方法1:显式指定compat参数

在s390x的-drive选项中添加compat=1.1,强制QEMU使用对应版本的qcow2兼容逻辑:

qemu-system-s390x -machine s390-ccw-virtio -cpu max,zpci=on -smp 8 -m 8192 -nographic \
    -drive file=disk.qcow2,format=qcow2,compat=1.1,if=none,id=drive-virtio-disk0,cache=none \
    -device virtio-blk-ccw,devno=fe.0.0002,drive=drive-virtio-disk0,bootindex=1 \
    -nic user,hostfwd=tcp::2288-:22

方法2:重新转换镜像格式

使用qemu-img将原镜像转换为Windows s390x兼容的qcow2格式,确保镜像元数据适配Windows平台:

qemu-img convert -f qcow2 -O qcow2 -o compat=1.1 disk.qcow2 disk_win_s390x.qcow2

转换完成后,使用新生成的disk_win_s390x.qcow2启动虚拟机。

方法3:降级QEMU版本

将Windows上的QEMU版本降级为与macOS一致的9.0.2版本,排除预发布版本的bug影响。

方法4:检查文件路径

确保镜像文件路径不包含中文或特殊字符,尝试使用绝对路径指定镜像文件,例如:

-drive file=C:\your\path\to\disk.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none

内容的提问来源于stack exchange,提问作者Thierry Lelegard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 12:50:58