Virtualization

如何確定磁碟映像文件格式:VMDK、VHD 還是原始文件格式?

  • September 21, 2021

是否有任何 shell 命令可以用來確定磁碟映像文件的格式?我想檢查磁碟映像文件是以下哪種格式:vmdk、原始文件的 vhd。

qemu-img info您可以使用該命令確定虛擬磁碟映像的格式。例如:

# qemu-img info amzn2-kvm-2017.12.0.20171212.2-x86_64.xfs.gpt.qcow2 
image: amzn2-kvm-2017.12.0.20171212.2-x86_64.xfs.gpt.qcow2
file format: qcow2
virtual size: 25 GiB (26843545600 bytes)
disk size: 1.61 GiB
cluster_size: 65536
Format specific information:
   compat: 1.1
   compression type: zlib
   lazy refcounts: false
   refcount bits: 16
   corrupt: false
   extended l2: false

用於qemu-img -h查看特定版本支持的格式。它們將出現在輸出的末尾附近。例如:

Supported formats: blkdebug blklogwrites blkverify bochs cloop compress copy-on-read dmg file ftp ftps gluster host_cdrom host_device http https iscsi iser luks nbd nfs null-aio null-co nvme parallels qcow qcow2 qed quorum raw rbd replication ssh throttle vdi vhdx vmdk vpc vvfat

引用自:https://serverfault.com/questions/1078111