qemu-img allows you to create, convert and modify images offline. It can handle all image formats supported by QEMU.
qcow2
qemu最通用的镜像文件格式,在文件系统上能够占用更小的存储空间,并且具备可选的一些配置项,比如AES加密、zlib压缩、快照等。
qemu-img convert -t none -f qcow2 -O host_device input_disk_image output_host_device
要使用 qemu-img
将磁盘映像文件从一种格式转换为另一种格式,可以指定输入格式( -f
)和输出格式( -O
)以及源和目标位置. 在本例中,您希望将磁盘映像转换为 host_device
格式
- `-f qcow2`: Specifies the input format as qcow2.
- `-O host_device`: Specifies the output format as host_device.
- `input_disk_image`: Path to the input disk image file you want to convert.
- `output_host_device`: Path to the output host device file.
-t 无压缩类型
$ qemu-img info Win2k.img
image: Win2k.img
file format: qcow2
virtual size: 30 GiB (32212254720 bytes)
disk size: 914 MiB
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
file format
blkdebug blklogwrites blkreplay blkverify bochs cloop
copy-on-read dmg file ftp ftps host_cdrom host_device
http https iscsi iser luks nbd null-aio null-co nvme
parallels qcow qcow2 qed quorum raw rbd replication
sheepdog ssh throttle vdi vhdx vmdk vpc vvfat