1

I need to get more graphics memory on my QEMU Windows client.

I decided to install Virtio drivers for QEMU to achieve that purpose.

I create an imagine_file like this:

qemu-img create -f raw image_file 4G

Also, I ran the windows-install like this:

qemu-system-x86_64 -enable-kvm -m 4G -cdrom "OS.iso" -boot order=c -drive file=image_file,if=virtio

But when Windows ran, it didn't find any hard-drive (the image_file basically). It asked for some drivers instead. I think it wanted drivers to communicate with the hard-drive (image_file).

Running the install without Virtio works though:

qemu-system-x86_64 -enable-kvm -m 4G -cdrom "OS.iso" -boot order=d -drive file=image_file,format=raw

The difference betweeen the two commands is:

order=c vs order=d

and

if=virtio vs format=raw

How do I install windows with Virtio in QEMU?

My original goal is to get 512 MB of graphics memory on Windows (running as a guest in QEMU). Unfortunately, by default (no Virtio) I get 8MB of video memory which is not enough for my purposes

Thanks

P.S. My OS is Arch-Linux

0

From Archwiki:

Windows does not come with the virtio drivers. Therefore, you will need to load them during installation. There are basically two ways to do this: via Floppy Disk or via ISO files. Both images can be downloaded from the Fedora repository. The floppy disk option is difficult because you will need to press F6 (Shift-F6 on newer Windows) at the very beginning of powering on the QEMU. This is difficult since you need time to connect your VNC console window. You can attempt to add a delay to the boot sequence. See qemu(1) for more details about applying a delay at boot. The ISO option to load drivers is the preferred way, but it is available only on Windows Vista and Windows Server 2008 and later. The procedure is to load the image with virtio drivers in an additional cdrom device along with the primary disk device and Windows installer:

So your installation command should include your hard disk image and the windows installer iso file and the virtio drivers :

$ qemu-system-x86_64 ... \
-drive file=/path/to/primary/disk.img,index=0,media=disk,if=virtio \
-drive file=/path/to/installer.iso,index=2,media=cdrom \
-drive file=/path/to/virtio.iso,index=3,media=cdrom \
...

During the installation, the Windows installer will ask you for your Product key and perform some additional checks. When it gets to the "Where do you want to install Windows?" screen, it will give a warning that no disks are found. Follow the example instructions below (based on Windows Server 2012 R2 with Update).

  • Select the option Load Drivers.
  • Uncheck the box for "Hide drivers that aren't compatible with this computer's hardware".
  • Click the Browse button and open the CDROM for the virtio iso, usually named "virtio-win-XX".
  • Now browse to E:\viostor[your-os]\amd64, select it, and press OK.
  • Click Next

You should now see your virtio disk(s) listed here, ready to be selected, formatted and installed to.

EDIT1:Linked to Fedora repository

EDIT2:Note: Some drivers have specific properties:

  • the virtio GPU uses max_hostmem instead to specify how much host memory it’s allowed to use.
0

You need to add a device to your VM. For example, if you decided to use VGA adapter (mode), your code should look like this:

qemu-system-x86_64 -enable-kvm -m 4G -cdrom "OS.iso" -boot order=c -drive file=image_file,if=virtio -device VGA,vgamem_mb=256

You can get the list of the devices that is possible to add to the VM by running the following command (print a list of QEMU supported devices by category):

qemu-system-x86_64 -device help

Additionally, the options per device can be determined by running:

qemu-system-x86_64 -device device_name,help

For the example with VGA adapter:

qemu-system-z86_64 -device VGA,help

Here is a similar post: How to set video memory with KVM/QEMU virtualization?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.