Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

What a Hypervisor Does

A hypervisor, also called a virtual machine monitor, sits between the physical hardware and the virtual machines (guests) that run on it. Each guest sees what looks like a complete computer: processors, memory, a disk, and a network card. The hypervisor decides which guest runs on which physical core at any moment, keeps each guest's memory separate from the others, and turns the guest's disk and network operations into operations on real hardware.

Modern processors help with this work. Intel VT-x and AMD-V let a guest's code run directly on the processor while the hypervisor stays in control, so a virtual machine runs close to the speed of the hardware underneath.

Type 1 and Type 2 Hypervisors

Type 1 (bare metal)Type 2 (hosted)
Runs onThe hardware directlyA desktop operating system
Typical useServers and data centersTesting on a workstation
OverheadLowHigher
ExamplesESXi, Xen, KVMVirtualBox, VMware Workstation

A type 1 hypervisor is the first thing that starts on the machine, and the guests run on top of it. A type 2 hypervisor is an application that you install on an ordinary operating system, which then shares the hardware with everything else on that computer. Servers almost always use type 1.

Where KVM Fits

KVM (Kernel-based Virtual Machine) is a module of the Linux kernel. Loading it turns Linux itself into the hypervisor. Each virtual machine is a regular Linux process, usually QEMU, that the kernel schedules like any other process while the processor's virtualization features do the heavy lifting. Because the kernel runs directly on the hardware, KVM is normally counted as type 1, although it also looks like type 2 from the outside. The details are in what is KVM virtualization.

Common Hypervisors

  • KVM: part of the Linux kernel, open-source, and the base of most Linux virtualization platforms.
  • Xen: an open-source type 1 hypervisor with a small core; a privileged guest called dom0 handles the drivers.
  • VMware ESXi: a commercial type 1 hypervisor with its own small operating system, managed through vSphere tools.
  • Proxmox VE: a Debian-based platform that manages KVM virtual machines and LXC containers through a web interface. It is a management layer around KVM, not a separate hypervisor. See how to install Proxmox VE.
  • VirtualBox: an open-source type 2 hypervisor for desktops.

Virtio: Faster Virtual Devices

A hypervisor can emulate real hardware, such as an old network card that every operating system knows. Emulation costs processor time on every packet and every disk block. Virtio devices are paravirtualized instead: the guest knows it runs in a virtual machine and talks to the hypervisor through a simple, efficient interface. The Linux kernel includes the virtio drivers, so a Linux guest uses them without extra setup. Check from inside the server:

lsmod | grep virtio
lspci | grep -i virtio

A disk on virtio-blk appears as /dev/vda; one on virtio-scsi appears as /dev/sda. The network driver is virtio_net.

See Which Hypervisor Runs Your Server

systemd-detect-virt
lscpu | grep -i hypervisor

The first command prints a short name such as kvm, xen, or vmware, and none on physical hardware. The second shows the line "Hypervisor vendor" when the system runs as a guest.

Hypervisors and Containers

Containers, such as Docker or LXC, do not use a hypervisor. They share the kernel of the host and are separated by kernel features. A virtual machine has its own kernel, so you can load kernel modules, run a different distribution, or run Docker inside it, as in how to install Docker on Ubuntu.

Hypervisors and Server Types

A VPS is a virtual machine on a hypervisor that your provider runs. A dedicated server gives you the hardware itself, and you can install your own hypervisor on it, for example with KVM on Ubuntu. The trade-offs between the two are in VPS vs dedicated server.

Was this answer helpful?
Loading...