---
website: https://www.qemu.org
obj: application
repo: https://github.com/qemu/qemu
rev: 2024-05-02
---

# QEMU
QEMU is an open-source emulator and virtualizer that enables running operating systems and various software applications on different hardware architectures. It supports [emulation](../emulation/Emulation.md) of various CPU architectures, including x86, ARM, PowerPC, and SPARC, among others. It allows running [virtual machines](../tools/Virtual%20Machine.md).

## QCow Image
qcow is a file format for disk image files used by QEMU. It stands for "QEMU Copy On Write" and uses a disk storage optimization strategy that delays allocation of storage until it is actually needed. Files in qcow format can contain a variety of disk images which are generally associated with specific guest operating systems. Three versions of the format exist: qcow, qcow2 and qcow3 which use the .qcow, .qcow2 and .qcow3 file extensions, respectively.

**Create a new image**: `qemu-img create -f qcow2 -s 10G my_image.qcow2`

## Usage
### x86
To use QEMU, you typically need a disk image containing the operating system you want to emulate.

```
qemu-system-x86_64 -drive <disk_image>
```

#### Options

| Option               | Description                                                                                                                                           | Example                                                                    |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `-cpu <cpu>`         | Specifies the CPU model or architecture to emulate. This flag is useful for emulating different CPU types.                                            | `qemu-system-x86_64 -cpu host`                                             |
| `-smp <smp>`         | Specifies the number of CPU cores to emulate in the [virtual machine](../tools/Virtual%20Machine.md).                                                 | `qemu-system-x86_64 -hda <disk_image> -smp 4`                              |
| `-m <mem>`           | Sets the amount of RAM to allocate for the [virtual machine](../tools/Virtual%20Machine.md).                                                          | `qemu-system-x86_64 -m 2G -hda <disk_image>`                               |
| `-netdev <netdev>`   | Configures networking for the [virtual machine](../tools/Virtual%20Machine.md).                                                                       | `qemu-system-x86_64 -hda <disk_image> -netdev user,id=network0`            |
| `-device <device>`   | Adds a specific device to the [virtual machine](../tools/Virtual%20Machine.md), such as a network interface card (NIC), graphics card, or sound card. | `qemu-system-x86_64 -hda <disk_image> -device e1000,netdev=network0`       |
| `-display <display>` | Specifies the display driver to use for the [virtual machine](../tools/Virtual%20Machine.md). Useful for setting up a graphical interface.            | `qemu-system-x86_64 -hda <disk_image> -display gtk`                        |
| `-monitor`           | Opens a monitor console for managing and interacting with the [virtual machine](../tools/Virtual%20Machine.md) during runtime.                        | `qemu-system-x86_64 -hda <disk_image> -monitor stdio`                      |
| `-vga <vga>`         | Specifies the graphics card model to emulate. Options include cirrus, std, vmware, qxl, and virtio.                                                   | `qemu-system-x86_64 -hda <disk_image> -vga virtio`                         |
| `-enable-kvm`        | Enables KVM (Kernel-based Virtual Machine) acceleration if supported by the host system. This improves performance significantly.                     | `qemu-system-x86_64 -hda <disk_image> -enable-kvm`                         |
| `-drive <drive>`     | Allows more advanced configuration of disk drives, including specifying disk format, caching mode, and other options.                                 | `qemu-system-x86_64 -drive file=<disk_image>,format=qcow2,cache=writeback` |
| `-cdrom <cdrom>`     | Specifies the CD-ROM image to use for booting or installing from a CD.                                                                                | `qemu-system-x86_64 -cdrom <cdrom_image>`                                  |
| `-soundhw <soundhw>` | Specifies the sound hardware to emulate in the [virtual machine](../tools/Virtual%20Machine.md).                                                      | `qemu-system-x86_64 -hda <disk_image> -soundhw hda`                        |
