Using Qemu Tools

While moving virtual machines from my unraid NAS to my new proxmox node way back when, I ended up needing to use a few of the qemu-img tools. This is a toolset for handling virtual disks used by kvm/qemu.

Conversions

Something I hadn’t realized while using unraid as my kvm host was that it wasn’t always using qcow2 format, which was my go to format, despite that the webui saying that the file format was qcow2. There were also a few virtual machines I made that ended up in different forms, so to handle these, I ended up having to convert the machines using the following commands.

The first command is to convert from a raw image to a qcow2 file.

qemu-img convert -f raw - O qcow2 /path/to/file.img

The second command is to convert from a qcow to a qcow2 file.

qemu-img convert -f qcow2 -O qcow2 /path/to/img.qcow

File Information

The other command I made use of was the info command from the qemu-img tool. This gives out useful file information for the file input to the command.

qemu-img info

These are just some useful, small commands in the qemu toolbox that can help significantly when working with the VM disk files directly.