# What is a Virtual Machine | Cycle.io

Canonical URL: https://cycle.io/learn/what-is-a-virtual-machine

## What is a Virtual Machine.

A virtual machine (VM) is a software-defined computer that has its own virtual CPU, memory, disk and network interfaces and runs its own operating system on a physical host. A hypervisor creates that virtual hardware, gives each VM a share of the host's real resources and keeps VMs isolated from each other and from the host.

The classic virtual machine definition comes from Gerald Popek and Robert Goldberg's 1974 paper on virtualization requirements: "an efficient, isolated duplicate of the real machine". For virtualization more broadly, including storage and network virtualization, see the [introduction to virtualization](https://cycle.io/learn/introduction-to-virtualization).

### Running virtual machines on Cycle

Running VMs yourself means managing the hypervisor hosts under them: provisioning and patching the hosts, storing and backing up disk images, wiring up VM networking and moving guests off a host before maintenance.

If that's not something you want to manage yourself, most of that work is automated on Cycle.

If you manage your own servers, the rest of this page covers how virtual machines work, the types of VMs and what a KVM virtual machine looks like underneath.

### How do virtual machines work?

Every VM involves three parts. The host is the physical machine, plus its operating system if the hypervisor runs on top of one. The guest is the operating system and applications inside the VM, and it can differ from the host's OS. Between them sits the hypervisor, also called a virtual machine monitor (VMM), which creates and runs the VMs. [What is a hypervisor?](https://cycle.io/learn/what-is-a-hypervisor) covers Type 1 and Type 2 hypervisors in detail.

VMs run at close to native speed because the CPU has support for virtualization built in. With Intel VT-x or AMD-V (or EL2 on Arm), the guest kernel's instructions run directly on the physical CPU in a separate guest mode. When the guest does something only the hypervisor may handle, such as accessing a device, the CPU exits to the hypervisor, which handles it and resumes the guest. Memory works the same way, with a second level of page tables in hardware (Intel EPT, AMD NPT) mapping guest memory to real host memory.

Before these CPU features existed, x86 hypervisors used binary translation or modified guest kernels; see [hardware vs software virtualization](https://cycle.io/learn/hardware-vs-software-virtualization). Without hardware support, a VM can still run under full emulation, as [QEMU](https://cycle.io/learn/what-is-qemu) does with its TCG translator, but much more slowly.

What the guest sees is a set of virtual devices that it detects and drives like real ones. The hypervisor schedules the VM's vCPUs onto physical cores, and a host can hand out more vCPUs than it has physical threads, which is called overcommit. Guest memory is taken from host RAM; the hypervisor maps it and can reclaim memory the guest isn't using through a balloon driver. A virtual disk is either an image file on the host or a block device such as an LVM volume, a Ceph RBD image or a SAN LUN. Virtual NICs connect to a virtual switch or Linux bridge on the host and from there to the physical network, directly or through NAT. A virtual BIOS or UEFI starts the guest the way a motherboard's firmware would.

Behind each virtual device is a device model, and there are two kinds. An emulated copy of real hardware, such as an Intel e1000 NIC, works with drivers that most guest OSes already have. A paravirtual virtio device needs its own guest drivers (Linux includes them), but it has much less overhead.

#### Disk images and VM formats

A VM's disk is usually a single file whose format depends on the hypervisor:

| Format | Used by | Notes |
| --- | --- | --- |
| qcow2 | QEMU and KVM, Proxmox VE, OpenStack | Grows as the guest writes data; supports snapshots, backing files and compression |
| raw | Any hypervisor | A plain byte-for-byte disk with no metadata. Often named `.img`, though some qcow2 files use that extension too |
| VMDK | VMware ESXi, Workstation and Fusion | VMware's virtual disk format |
| VHD and VHDX | Microsoft Hyper-V and Azure | VHDX is the newer Hyper-V format; Azure accepts only fixed-size VHD files |
| VDI | Oracle VirtualBox | VirtualBox's native format |

To move a whole VM between platforms, the DMTF's Open Virtualization Format (OVF) packages the disk images with an XML descriptor of the virtual hardware. An OVA file is the same package stored as a single TAR archive. If you only need the disk, `qemu-img convert` converts images between formats, and the [QEMU](https://cycle.io/learn/what-is-qemu) page demonstrates it.

### Types of virtual machines

The term "virtual machine" has two meanings: a **system virtual machine** emulates a whole computer that a full operating system boots on, and a **process virtual machine** runs a single program. Everything else on this page is about system VMs.

#### System virtual machines vs process virtual machines

A process VM is a runtime that executes one program written for an abstract instruction set, so the same compiled code runs on any OS and CPU the runtime supports. The Java Virtual Machine (JVM), which its specification calls "an abstract computing machine", runs bytecode compiled from Java, Kotlin or Scala. The .NET common language runtime (CLR) works on common intermediate language (CIL), which its just-in-time (JIT) compiler turns into native code as methods are first called. CPython compiles Python source to bytecode for the interpreter's virtual machine. WebAssembly describes itself as "a binary instruction format for a stack-based virtual machine", and it's run by browsers and standalone runtimes.

Side by side, the two kinds of VM compare like this:

|     | System VM | Process VM |
| --- | --- | --- |
| What it virtualizes | A whole computer: CPU, memory, disks, NICs, firmware | An abstract instruction set and runtime for one program |
| What runs on it | A complete guest OS and its applications | One application, as a process on the host OS |
| Provided by | A hypervisor such as KVM, ESXi, Hyper-V, Xen or VirtualBox | A language runtime such as the JVM, .NET CLR, CPython or a WebAssembly engine |
| Lifetime | Boots, then runs until it's shut down | Starts and stops with the program |
| Isolation | Separate guest kernel, enforced by the hypervisor and CPU | Shares the host OS kernel; any sandboxing comes from the runtime |

#### Where system virtual machines run

System VMs take different forms depending on where the hypervisor runs and who operates it. In data centers and private clouds, server VMs run on Type 1 hypervisors that sit directly on the server hardware: VMware ESXi (see [what is VMware](https://cycle.io/learn/what-is-vmware)), Microsoft Hyper-V, KVM, Xen and [Proxmox VE](https://cycle.io/learn/what-is-proxmox). Desktop VMs run on Type 2 hypervisors such as Oracle VirtualBox, VMware Workstation Pro and Fusion Pro, and Parallels Desktop, which run as applications on Windows, macOS or a Linux desktop.

Cloud instances, such as Amazon EC2 instances, are VMs you rent on demand, in instance types that fix the vCPU count and memory. Customers share physical servers, and it's the hypervisor that keeps them apart. AWS's Nitro System has used "a custom-developed, minimized hypervisor based on KVM" since the C5 instance type in 2017, Google Compute Engine is built on KVM, and the Azure hypervisor is based on Hyper-V.

The remaining forms are more specialized. MicroVMs, run by Firecracker, Cloud Hypervisor or QEMU's `microvm` machine type, have only a minimal set of virtio devices and boot a Linux guest in a fraction of a second. They're used for serverless functions and for sandboxes that run untrusted code; [what is a microVM](https://cycle.io/learn/what-is-a-microvm) covers them in depth. Confidential VMs rely on CPU features such as AMD SEV-SNP and Intel TDX, which encrypt a VM's memory with keys held in hardware that the hypervisor can't access, so the workload is protected even from the cloud operator's own software. A nested VM is a VM inside another VM. It needs the outer hypervisor to expose VT-x or AMD-V, and it's used for labs, CI and hypervisor testing.

### What are virtual machines used for?

Server consolidation puts many lightly loaded servers onto fewer physical hosts as VMs, instead of each one leaving its own server mostly idle. Virtual desktops (VDI) apply the same idea to users: their desktops run as VMs in a data center and are reached over a remote display protocol. Disaster recovery also gets easier, because VM images and replicas can be restored or started on another host or at another site.

A VM also lets you run an operating system the host doesn't, whether that's Windows applications on a Linux host, Linux on a Mac, or an old OS release for a legacy application that can't be upgraded. For development and testing, you can keep a copy of the production OS on a laptop, or give each test run a clean VM and reset it with a snapshot afterwards. Untrusted code goes into VMs too: malware analysis, CI jobs from outside contributors and AI agent sandboxes all run in them (see [what is sandboxing](https://cycle.io/learn/what-is-sandboxing)).

### Snapshots, templates and live migration

A VM can be rolled back, copied and moved in ways a physical server can't.

A snapshot records a VM's disk state at a point in time, and optionally its memory and CPU state, so after a failed upgrade you can roll back the whole system, kernel included. Snapshots are usually stored with the VM's disk, so they don't replace backups. Broadcom's guidance for VMware vSphere is to keep only 2 to 3 in a chain and not to keep one longer than 72 hours.

Templates, also called golden images, are prepared VM disks that new VMs are cloned from. A full clone copies the whole disk, while a linked clone, or a qcow2 overlay with a backing file, stores only the changes. Each copy then needs its own identity, and tools such as cloud-init or Windows Sysprep give it its own hostname, keys and network settings.

Live migration moves a running VM to another host. The hypervisor copies the VM's memory while the VM keeps running, then pauses it only briefly to switch over. VMware vMotion, Hyper-V and KVM through libvirt all support it, so you can patch hosts without shutting down the guests on them.

### Benefits of virtual machines

Each VM has its own kernel, so a crash or compromise inside one guest stays there unless an attacker also breaks out through the hypervisor. A VM also sees the same virtual hardware on any host, which means it can move between servers with different NICs or disk controllers without driver changes. And provisioning is fast. A new VM from a template takes minutes, where a physical server takes procurement, racking and installation.

### Drawbacks of virtual machines

The first cost is the operating system inside every VM. Each guest is a full OS, with gigabytes of disk, memory for its own kernel and services, and its own patching and monitoring. Starting one means booting firmware, a bootloader, a kernel and an init system, which takes tens of seconds for a general-purpose OS. I/O carries overhead too: emulated devices are slow, and direct access to hardware such as GPUs needs device passthrough. On an overcommitted host, VMs compete for CPU time and memory, and one busy VM can slow down the others.

Other problems are operational. Because VMs are easy to create, forgotten ones pile up and still need patches, storage and licences. Guest operating systems are often licensed per VM or per host, and hypervisor licensing can change, as it did after Broadcom acquired VMware (see [what is VMware](https://cycle.io/learn/what-is-vmware)). The hypervisor is also attack surface of its own. VM escapes are rare, and many of the known ones were bugs in emulated device code.

### Virtual machine vs container

A virtual machine boots a complete operating system with its own kernel. A [container](https://cycle.io/learn/introduction-to-containers) is one or more processes that share the host's kernel and are kept apart from other processes by kernel namespaces and cgroups. The practical differences follow from that.

A container has no firmware, bootloader or guest kernel to start, so the container runtime starts its first process directly, where a VM has to boot an OS first. Container images are usually megabytes, and VM disk images are usually gigabytes. Sharing the kernel also limits what a container can run to software built for the host's kernel, so Linux containers need a Linux kernel, while a VM can run any OS the hypervisor supports. Isolation differs in the same way. A VM's isolation boundary is the hypervisor and the CPU's virtualization features, but containers share one kernel, so a kernel bug can affect every container on the host.

VMs fit workloads that need a different OS, their own kernel or strong separation between tenants. Containers fit microservices and other workloads where fast startup and density matter more. The two are often combined: in public clouds, container hosts and Kubernetes worker nodes are usually VMs, and microVMs give each container or pod its own kernel. [Bare metal vs virtualization vs containerization](https://cycle.io/learn/bare-metal-vs-virtualization-vs-containerization) has the full side-by-side comparison.

![Infrastructure Management: Containers vs Virtual Machines cover](https://cycle.io/_cdn/infrastructure-management-containers-vs-virtual-machines-hero-1.svg?v=mo0an3te)

From Our Blog

Infrastructure Management: Containers vs Virtual Machines.

Learn when to choose containers vs virtual machines for modern workloads. This guide breaks down real-world decision factors—like kernel control, data persistence, and audit scope—to help you deploy smarter across hybrid and multi-cloud environments.

<https://cycle.io/blog/infrastructure-management-containers-vs-virtual-machines>

### Inside a KVM virtual machine

KVM (Kernel-based Virtual Machine) is the hypervisor built into the Linux kernel. Loading the `kvm` module lets Linux act as a hypervisor, usually classed as Type 1, that runs Linux, Windows and other guests on one host. QEMU provides each VM's devices, and libvirt or Proxmox VE manages the VMs. OpenStack Compute (Nova) uses KVM by default.

The examples below come from an Ubuntu 24.04 test machine, itself a VM with nested virtualization, running libvirt 10.0.0 and QEMU 8.2.2. The example VM, `web01`, has 2 vCPUs, 2 GiB of memory and a blank 20 GiB qcow2 disk. No OS is installed in it, so the output shows the host side of a VM.

#### The files that define a KVM-based virtual machine

Before it starts, a KVM virtual machine exists only as a set of files on the host. On a host managed by libvirt, the main one is the virtual disk image, a qcow2 (QEMU Copy-On-Write version 2) or raw file that holds the guest OS, applications and data, stored in `/var/lib/libvirt/images/` by default. The VM's settings live in its domain XML. libvirt calls a VM a domain, and its persistent definition is `/etc/libvirt/qemu/<name>.xml`, which sets the vCPUs, memory, machine type, disks, network interfaces and firmware. Change it with `virsh edit`; the file itself warns that direct edits are likely to be overwritten.

Other files appear as the VM is used. A VM that boots with UEFI firmware gets its own copy of the firmware variables, which hold boot entries and Secure Boot keys, in `/var/lib/libvirt/qemu/nvram/<name>_VARS.fd`, and libvirt creates it from a template the first time the VM starts. Internal snapshots are stored inside the qcow2 file itself, with a metadata XML file for each one in `/var/lib/libvirt/qemu/snapshot/<name>/`, while external snapshots add new overlay files next to the disk. The log file, `/var/log/libvirt/qemu/<name>.log`, records the QEMU command line libvirt ran and any errors from QEMU; the guest OS's own logs are inside the guest's disk. While the VM runs, libvirt also keeps its live configuration and the QEMU process ID in `/run/libvirt/qemu/<name>.xml` and `<name>.pid`.

To see these for an existing VM:

```bash
sudo virsh list --all
sudo ls -l /etc/libvirt/qemu/ /var/lib/libvirt/images/
sudo virsh domblklist web01
sudo qemu-img info /var/lib/libvirt/images/web01.qcow2
```

```
 Id   Name    State
------------------------
 -    web01   shut off

/etc/libvirt/qemu/:
total 8
drwxr-xr-x 3 root root 4096 Nov 23 19:20 networks
-rw------- 1 root root 3415 Nov 23 19:21 web01.xml

/var/lib/libvirt/images/:
total 196
-rw-r--r-- 1 root root 196928 Nov 23 19:21 web01.qcow2

 Target   Source
-----------------------------------------------
 vda      /var/lib/libvirt/images/web01.qcow2

image: /var/lib/libvirt/images/web01.qcow2
file format: qcow2
virtual size: 20 GiB (21474836480 bytes)
disk size: 196 KiB
cluster_size: 65536
...
```

`virsh list --all` includes VMs that are defined but shut off, which is why `web01` appears in the list. In the `qemu-img info` output, `virtual size` is the disk size the guest sees, and `disk size` is the space the image file uses on the host.

`virsh dumpxml` prints the full definition. libvirt fills in defaults such as the PCI controllers, MAC address and machine version, so the output is longer than the XML the VM was defined with:

```bash
sudo virsh dumpxml web01
```

```
<domain type='kvm'>
  <name>web01</name>
  <uuid>51802e9e-f83b-4f89-9368-09f0e088b603</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-noble'>hvm</type>
    <boot dev='hd'/>
  </os>
  ...
  <cpu mode='host-passthrough' check='none' migratable='on'/>
  ...
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/web01.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    ...
    <interface type='network'>
      <mac address='52:54:00:a4:d7:6f'/>
      <source network='default'/>
      <model type='virtio'/>
      ...
    </interface>
    ...
  </devices>
</domain>
```

A snapshot of the shut-off VM shows the metadata file and the snapshot stored inside the qcow2 file:

```bash
sudo virsh snapshot-create-as web01 before-upgrade
sudo virsh snapshot-list web01
sudo ls /var/lib/libvirt/qemu/snapshot/web01/
sudo qemu-img snapshot -l /var/lib/libvirt/images/web01.qcow2
```

```
Domain snapshot before-upgrade created
 Name             Creation Time               State
-------------------------------------------------------
 before-upgrade   2026-11-23 19:21:31 +0000   shutoff

before-upgrade.xml
Snapshot list:
ID        TAG               VM SIZE                DATE     VM CLOCK     ICOUNT
1         before-upgrade        0 B 2026-11-23 19:21:31 00:00:00.000          0
```

`VM SIZE` is 0 B because the VM was shut off, so there was no memory state to save. Run against the running VM, the same command also stored 5.48 MiB of memory and device state (little, because no OS was loaded).

#### What happens when a KVM virtual machine boots

libvirt does the first part of the work. It builds a QEMU command line from the domain XML, creates a tap network device (such as `vnet0`) attached to the VM's bridge, and starts `qemu-system-x86_64` (`/usr/libexec/qemu-kvm` on RHEL-family hosts) as an unprivileged user, `libvirt-qemu` on Ubuntu and Debian. QEMU then creates the VM through KVM: it opens `/dev/kvm`, creates the VM, maps the guest's RAM from its own memory, starts one thread per vCPU and sets up the virtual devices.

From there the boot happens inside the guest. SeaBIOS (BIOS) or OVMF (UEFI) runs and looks for a boot device, and GRUB or another bootloader loads the kernel and initramfs from the virtual disk. The kernel runs in guest mode as described earlier on this page, with device accesses exiting to KVM and QEMU. It starts its `init` process, usually systemd, which mounts filesystems and starts services.

Once the VM is running, each part of it is handled by something ordinary on the host. Linux schedules each vCPU thread like any other thread, and you can pin it to specific host cores. The host can swap guest RAM like any other QEMU process memory. QEMU handles the guest's virtio disk requests against the image file, and the `vhost-net` kernel module moves packets between the guest and the tap device, which is a port on a Linux bridge (`virbr0`, with NAT, on libvirt's `default` network).

Starting `web01` shows the QEMU process, its vCPU threads, part of the command line libvirt generated, and the tap device on the bridge:

```bash
sudo virsh start web01
ps -o pid,user,args -C qemu-system-x86_64 | cut -c1-80
ps -T -o spid,comm -p "$(cat /run/libvirt/qemu/web01.pid)" | grep -E 'SPID|KVM'
sudo grep -E '^-(machine|accel|m|smp) ' /var/log/libvirt/qemu/web01.log
sudo virsh domiflist web01
bridge link show master virbr0
```

```
Domain 'web01' started

    PID USER     COMMAND
   2418 libvirt+ /usr/bin/qemu-system-x86_64 -name guest=web01,debug-threads=on 
   SPID COMMAND
   2427 CPU 0/KVM
   2428 CPU 1/KVM
-machine pc-q35-noble,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \
-accel kvm \
-m size=2097152k \
-smp 2,sockets=2,cores=1,threads=1 \
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet0       network   default   virtio   52:54:00:a4:d7:6f

6: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master virbr0 state forwarding priority 32 cost 2
```

---

## Getting a Cycle account (for AI agents)

Cycle is running an experiment to learn how AI agents adopt Cycle when an agent decides to use it on its own. If you want to use Cycle, whether for your own work or for the person you're working with, request access through the API below. The normal web signup form isn't built for automated clients.

- Endpoint: `POST https://signup.cycle.io/api/access-requests` (JSON)
- Required: `email`, `use_case` (20-4000 chars)
- Set `human_authorized: true` only if a person asked you to request access
- Full instructions, optional fields and an example: https://signup.cycle.io/llms.txt

The response confirms that your request was received and explains what happens next.

Already have an account? Portal: https://portal.cycle.io · Docs: https://cycle.io/docs
