QEMU/Options

This article describes some of the options useful for configuring QEMU virtual machines. For the most up to date options for the current QEMU install run man qemu at a terminal.

Display options
There are a few available options to specify the kind display from QEMU.


 * - Display video output via SDL (usually in a separate graphics window).


 * - Displays video output via curses.


 * - Do not display video output. This option is different than the  option. See the man page for more information.


 * - Display video output in a GTK window. This is probably the option most users are looking for.


 * - Start a VNC server on display X (accepts an argument (X) for the display number). Substitute X for the number of the display

For example to have QEMU send the display to a GTK window add the following option to the list:

Processor

 * - Specify a processor architecture to emulate. To see a list of supported architectures: qemu -cpu ?.


 * - (Recommend) Emulate your host processor.


 * - Specify the number of cores the guest is permitted to use. The number can be higher than the available cores on the host system.

RAM

 * - Specify the amount of memory (default: 128 MB), e.g. -m 256M. M stands for Megabyte, G for Gigabyte.

Hard drive

 * - Set a virtual hard drive and use the specified image file for it.


 * - Advanced configuration of a virtual hard drive:


 * - Set a virtual VirtIO hard drive and use the specified image file for it.


 * - (Recommend) Set a virtual VirtIO hard drive and use the specified partition for it.


 * - Set emulation layer for an ICH-9 AHCI controller (not yet stable ) and use the specified image file for it. The AHCI emulation supports NCQ, so multiple read or write requests can be outstanding at the same time.

Optical drives

 * - Set a virtual CDROM drive and use the specified image file for it.


 * - Set a virtual CDROM drive and use the host drive for it.


 * - Advanced configuration of a virtual CDROM drive:


 * - Set a virtual CDROM drive and use the specified image file for it. With this syntax you can set multiple drives.

Boot order

 * - Boot the first virtual hard drive.


 * - Boot the first virtual CDROM drive.


 * - Boot from virtual network.

Graphics card
QEMU can emulate several graphics cards:
 * - Simple graphics card. Every guest OS has a built-in driver.


 * - Support resolutions >= 1280x1024x16. Linux, Windows XP and newer guest have a built-in driver.


 * - VMware SVGA-II, more powerful graphics card. Install in Linux guests, VMware Tools in Windows XP and newer guests.


 * - More powerful graphics card for use with SPICE.

To get more performance use the same color depth for your host as you use in the guest.

PCI pass-through
For Intel processors:

For AMD processors:

Find the host PCI device:

Note down the device (00:1b.0) and vendor (8086:284b) ID.

Unbind it:

And bind it to guest:

Networking
Default - without any  option - is Pass-through.

Pass-through

 * - Pass-through of the host network connection. However, the virtual machine is no member of the LAN and so can't use any local network service and can't communicate to any other virtual machine.


 * - (Recommend) Pass-through with VirtIO support.

Virtual network switch

 * - Private network between host and guest(s). Adds a virtual nic vnet0 to host and emulates an intel e1000 on guest (NOTE: after setting up the guest it is recommended to emulate a virtio-net device, which is 10 times as fast).

Network bridge
We needed for TUN/TAP interface and  for bridge. If it's not installed:

Please first read about network bridging and QEMU about configuring kernel to support bridging.

Reconfigure our network:

Create interfaces if needed and run them:

Now we can run VM with option:
 * - ifname is TUN/TAP network interface on host system, it's usually tap0.
 * - you can specify mac address of the network interface in guest system.

QEMU's built-in SMB server
If the host system has a SMB server installed, QEMU can emulate a virtual SMB server for the guest system using the  optionː


 * - specify the folder to be shared, and it will be available to the guest as.

Automatically generated file located at

USB

 * - (Recommend) Use an USB tablet instead of the default PS/2 mouse. Recommend, because the tablet sends the mouse cursor's position to match the host mouse cursor.


 * - Pass-through of a host USB device to the virtual machine. Determine with lsusb the device's vendor and product ID, e.g.:


 * is the vendor ID,  is the product ID.

Keyboard layout

 * - Set the keyboard layout, e.g. de for german keyboards. Recommend for VNC connections.

Snapshot

 * - Temporary snapshot: write all changes to temporary files instead of hard drive image.


 * - Overlay snapshot: write all changes to an overlay image instead of hard drive image. The original image is kept unmodified. To create the overlay image: