Step-by-Step Windows Virtual Machine Creation in KVM
This is a step-by-step illustration of the steps mentioned in the Windows QEMU/KVM Virtual Machine on Linux guide. Read the article first before following this guide. The screenshots were taken on Fedora 31.
- Created
- October 16, 2019
- Updated
- March 30, 2020
Create a Virtual Machine
Launch Virtual Machine Manager (virt-manager). Begin a new virtual machine creation wizard.

I suppose you have downloaded a Windows installation disk image in the ISO format. If not, download it from the Microsoft website. Note that you may need to run a Windows download tool first if you are accessing the Windows download page from a Windows machine. Accessing the Windows download website from Linux gives you the ISO file directly.
Select the Windows installation ISO file and let the Virtual Machine Manager recognize it as Windows 10 (or change it manually if the automatic recognition fails).




Set the amount of RAM memory to be allocated to the virtual machine. The more, the better. Be careful to leave a sufficient amount of RAM to the host operating system. Same with the number of processor cores.

Create a virtual hard drive for use in the virtual machine. More space can be allocated than what is actually available or used.


QCOW2 format of the virtual hard disk allows the creation of snapshots. RAW format is faster and does not support snapshots.



Check the Customize configuration before install option and click Finish.

Unless I have a reason not to, I use UEFI instead of the legacy BIOS option.
In Fedora 32, there is a new OVMF_CODE.secboot.fd option, which enables Secure Boot in the virtual machine. It works without any issue. The only limitation is that all drivers installed in a Windows virtual machine need to be signed by Microsoft or by the Linux distribution in the case of Linux. Secure Boot can be easily turned off later in the UEFI of the virtual machine.

The virtual disks (both QCOW2 and RAW) grow when they are filled with data. To also shrink virtual disks after deleting some data, TRIM operation can be used. TRIM/discard must be supported by both the guest operating system and the virtual disk/virtual disk controller.
Virtio SCSI on QEMU supports TRIM. SATA, and IDE emulations do not. Virtio BLK may have added experimental TRIM support recently.
I use Virtio SCSI, attach the virtual hard drive to it and enable the discard unmap function to pass the TRIM command all the way to the virtual hard drive (and allow its size to be shrunk after deleting data).


Change the CPU topology if you wish so. Is there a difference between one dual-core CPU and two single-core ones? Maybe in the guest OS licensing.

Install the Guest Operating System
After the virtual machine is created, it will start and boot from the installation CD/DVD.
When Installing Linux
Installing Linux guests is straightforward, no additional drivers are usually needed. Everything should work out of the box.
When Installing Windows
The virtual machine will boot into the installation process.

Because I used the Virtio SCSI controller for the hard drive, and Windows does not have a Virtio SCSI driver, it does not see the virtual hard drive.
The driver can be loaded from the ISO file with the latest VirtIO drivers from Fedora (Windows Guest Drivers page, Fedora VirtIO drivers ISO download)
Fedora-provided VirtIO drivers are not digitally signed by Microsoft. If you selected UEFI with Secure Boot enabled during the virtual machine creation, you might need to use VirtIO drivers provided by RHEL or CentOS in the virtio-win package, or disable Secure Boot in the UEFI of the virtual machine.


Insert the ISO image with the VirtIO drivers and let the installer search for the Virtio SCSI driver for Windows 10.




Insert back the Windows installation ISO image.

Now continue with the installation as usual by selecting the newly-detected virtual hard drive and clicking the Next button. It will create partitions automatically if you leave the space unallocated.

Once the operating system is installed, I let it install all updates.


Install Missing Drivers
If there are any unrecognized devices in the Device Manager, insert back the VirtIO driver ISO and install all missing drivers:
- listed under Other Devices,
- under Display adapters (update Basic Microsoft adapter with QXL driver.



Install Spice Guest Tools
Download the Windows guest tools (spice-guest-tools) from the SPICE guest tools download page. It will be an EXE file that can be installed on the guest Windows on the Virtual Machine.