1

Is there any shell command using which I can determine the format of a disk image file? I want to check that disk image file is in which of these formats: vmdk, vhd of raw file.

Abhay Gupta
  • 113
  • 4

1 Answers1

2

You can determine the format of a virtual disk image with the qemu-img info command. For example:

# 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

Use qemu-img -h to see the supported formats for your specific version. They will appear near the end of the output. For example:

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
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940