Skip to content

QEMU-img Workstation Cheat Sheet

Unlock the full potential of QEMU-img workstation with these essential commands and configuration tips. Learn how to create and resize disk images, install firmware, and manage drivers for your virtual machines.


Install requirements
emerge sys-apps/usbutils

Create hard drive

qemu-img create -f qcow2 <choose_disk_name>.img 100G

Create custom-sized image

qemu-img create myimage.img mysize

Create qcow2 image with a maximum size of 10GB

qemu-img create -f qcow2 myimage.img 10G

Increase the size of a qcow2 image

qemu-img resize myimage.img 20G

Create RAW image with a maximum size of 10GB

qemu-img create -f raw myimage.img 10G

Increase the size of a RAW image

qemu-img resize -f raw myimage.img 20G

Display attributes of a RAW image

qemu-img info /var/lib/libvirt/images/disk1.img

Install OVMF Binary to get EFI Firmware File For libvirtd/libvirtd-guets

emerge sys-firmware/edk2-ovmf
ln -s /usr/share/edk2-ovmf /usr/share/OVMF

In order to use the firmware you can run qemu the following way

qemu-system-x86_64 -drive file=/usr/share/edk2-ovmf/OVMF.fd,if=pflash,format=raw,unit=0,readonly=on ....

Install Virtiofs

emerge app-emulation/virtiofsd app-emulation/virtio-win

Example Install libvirtd and libvirt-guests

emerge --ask app-emulation/libvirt

Install the drivers on a Windows guest machine

Pass the ISO file to the guest machine and mount it as a CD-ROM image. Then, in the Windows guest, open the Device Manager and start the driver update wizard. Locate the appropriate device and click to update its driver. In the pop-up window, click to browse in the guest machine to locate the ISO image, and select the driver(s) from it to install.

/usr/share/drivers/windows/virtio-win.iso