How to know disk image format and other details of a guest disk using "qemu" commands ?

As you know there are different image formats which can be used for guest space.. Below are some of them with brief notes on it.

raw Raw disk image format (default). This format has the advantage of being simple and easily exportable to all other
emulators. If your file system supports holes (for example in ext2 or ext3 on Linux or NTFS on Windows), then only the
written sectors will reserve space. Use “qemu-img info” to know the real size used by the image or “ls -ls” on
Unix/Linux.

host_device
Host device format. This format should be used instead of raw when converting to block devices or other devices where
“holes” are not supported.

qcow2
QEMU image format, the most versatile format. Use it to have smaller images (useful if your filesystem does not
supports holes, for example on Windows), optional AES encryption, zlib based compression and support of multiple VM
snapshots.
qcow
Old QEMU image format. Left for compatibility.

cow User Mode Linux Copy On Write image format. Used to be the only growable image format in QEMU. It is supported only for
compatibility with previous versions. It does not work on win32.

vdi VirtualBox 1.1 compatible image format.

vmdk
VMware 3 and 4 compatible image format.

vpc VirtualPC compatible image format (VHD).

cloop
Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix
CD-ROMs.

I have a guest image (RHEL-5.img) and I would like to know details on the same. For that I am depending on “qemu-img” command which is available with “qemu-img” package in Fedora.

[hchiramm@humbles-lap Kernel_code]$ which qemu-img
/usr/bin/qemu-img
[hchiramm@humbles-lap Kernel_code]$ rpm -qf /usr/bin/qemu-img
qemu-img-0.13.0-1.fc14.x86_64
[hchiramm@humbles-lap Kernel_code]$

My guest images are stored under “default” location .

[root@humbles-lap images]# pwd
/var/lib/libvirt/images
[root@humbles-lap images]# ls
rhel5.4-x86_64-kvm-1.img rhel5.4-x86_64-kvm-2.img rhel5.4-x86_64-kvm-3.img rhel5.4-x86_64-kvm.img RHEL-5.img

[root@humbles-lap images]# qemu-img info RHEL-5.img
image: RHEL-5.img
file format: raw
virtual size: 512M (536870912 bytes)
disk size: 512M
[root@humbles-lap images]#

Leave a Reply

Your email address will not be published. Required fields are marked *