--- 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 ``` #### Options | Option | Description | Example | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | `-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 ` | Specifies the number of CPU cores to emulate in the [virtual machine](../tools/Virtual%20Machine.md). | `qemu-system-x86_64 -hda -smp 4` | | `-m ` | Sets the amount of RAM to allocate for the [virtual machine](../tools/Virtual%20Machine.md). | `qemu-system-x86_64 -m 2G -hda ` | | `-netdev ` | Configures networking for the [virtual machine](../tools/Virtual%20Machine.md). | `qemu-system-x86_64 -hda -netdev user,id=network0` | | `-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 -device e1000,netdev=network0` | | `-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 -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 -monitor stdio` | | `-vga ` | Specifies the graphics card model to emulate. Options include cirrus, std, vmware, qxl, and virtio. | `qemu-system-x86_64 -hda -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 -enable-kvm` | | `-drive ` | Allows more advanced configuration of disk drives, including specifying disk format, caching mode, and other options. | `qemu-system-x86_64 -drive file=,format=qcow2,cache=writeback` | | `-cdrom ` | Specifies the CD-ROM image to use for booting or installing from a CD. | `qemu-system-x86_64 -cdrom ` | | `-soundhw ` | Specifies the sound hardware to emulate in the [virtual machine](../tools/Virtual%20Machine.md). | `qemu-system-x86_64 -hda -soundhw hda` |