QEMU/Options

This article describes some of the options to configure a QEMU virtual machine.

Processor

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


 * -cpu host - (Recommend) Emulate your host processor.


 * -smp NUMBER - 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

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

Hard drive

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


 * -drive - Advanced configuration of a virtual hard drive:


 * -drive file=IMAGE.img,if=virtio - Set a virtual VirtIO hard drive and use the specified image file for it.


 * -drive file=/dev/sdX#,cache=none,if=virtio - (Recommend) Set a virtual VirtIO hard drive and use the specified partition for it.

Optical drives

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


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


 * -drive - Advanced configuration of a virtual CDROM drive:


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

Boot order

 * -boot c - Boot the first virtual hard drive.


 * -boot d - Boot the first virtual CDROM drive.


 * -boot n - Boot from virtual network.

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


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


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


 * -vga qxl - 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.

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

Pass-through

 * -net user - 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.


 * -net nic,model=virtio -net user - (Recommend) Pass-through with VirtIO support.

Virtual network switch
TODO

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

Please read first Network bridge and QEMU for configure kernel.

Reconfigure our network:

Create interfaces if needed and run them:

Now we can run VM with option:
 * -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio - ifname is TUN/TAP network interface on host system, it's usually tap0.
 * -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio,macaddr=00:12:34:56:78:9a - you can specify mac address of the network interface in guest system.

USB

 * -usbdevice tablet - (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.


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


 * 08ec is the vendor ID, 2039 is the product ID.

Source

 * Toko Bunga
 * Sewa Mobil Jakarta
 * Informasi Umum
 * Blog Kuliner

Keyboard layout

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

Snapshot

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


 * -hda OVERLAY.img - 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: