What is Kernel-Based Virtual Machine (KVM)?

Posted on by Thomas Janson | Updated:
Reading Time: 3 minutes

With the increased digitization of everyday life and broader adoption of cloud computing, virtualization has become one of the pillars of today’s Internet. Virtualization technology enables us to create virtual instances or virtual machines of operating systems, networks, and virtualized storage devices, significantly automating and simplifying IT processes, improving scalability, and significantly decreasing costs. Overall, it enables us to reduce the amount of used physical resources/servers by separating various processes onto multiple, customizable virtual machines.

Alongside several other popular full virtualization programs such as VMware or Oracle’s VirtualBox, one of the most commonly used virtualization solutions for Linux is Kernel-Based Virtual Machine (KVM).

What is Kernel-Based Virtual Machine (KVM)?

Kernel-Based Virtual Machine (KVM) is an open source virtualization module directly built into the Linux kernel, enabling Linux OS to function as a Type 1 (bare-metal) hypervisor. However, worth noting is that the distinction between Type 1 and Type 2 hypervisors can be blurred with KVM, as it can function as either of the two. Furthermore, it enables the hypervisor to deploy separate virtual machines. 

Avi Kivity originally started to develop KVM in 2006, and the module itself was merged with the Linux kernel mainline with version 2.6.20, released in 2007. Since then, it has evolved in popularity and today supports major CPU instruction sets (x86, ARM, BSD, Solaris) and a plethora of guest operating systems.

KVM Advantages 

  • Since the KVM module is built into the Linux kernel, it comes built-in with most Linux distributions.
  • KVM is open source, which means it's free to use, regularly updated, and very secure due to being part of the world's largest open source community.
  • KVM is very stable and has excellent performance with suitable hardware.
  • KVM has fantastic command-line options with a polished GUI interface.

KVM Disadvantages

  • Depending on a user's needs and infrastructure, the host hardware needs to be robust.
  • Because KVM is a Linux kernel module, it can't run on most operating systems with a few exceptions, such as FreeBSD and illumos.
  • Centralized hardware, which can be problematic in cases of failure

How does KVM Work?

To use KVM, users must ensure that their hardware setup meets specific requirements that vary depending on the host OS. The requirements also revolve around a CPU that supports virtualization technology. Enabling virtualization (if disabled) is done in the basic input/output system (BIOS).

KVM consists of two loadable modules. The two modules are:

  • The host kernel module or kvm.ko is used to lay out the virtualization infrastructure.
  • The processor-specific module (most commonly kvm-intel.ko and kvm-amd.ko), provides virtualization extensions.

Users install several packages to harness KVM’s full potential, such as qemu, libvirt-daemon, libvirt-clients, bridge-utils, and virt-manager. Implementing these packages depends on the host OS and is most widely used on CentOS and Ubuntu.

A benefit of having KVM built into the Linux kernel is that virtual machines (VMs) have access to all necessary system components. This access makes deploying VMs and assigning them custom virtual hardware resources simple.

KVM Features

Scalability and Clustering

KVM is an excellent solution for scalability and clustering. As resource demand increases, you can deploy the desired amount of VMs to meet all the workload needs and fine-tune them for specific tasks. Additionally, you can use KVM to set up server clusters or private clouds, such as OpenStack.

Virtio Devices and Hardware

Virtio is a virtualization standard primarily for storage and network devices used as the primary input/output (IO) virtualization platform in KVM. It enables high performance of disks and network devices on virtual guest machines.

By default, it supports a wide variety of hardware devices. This support also applies to new advancements in hardware technologies. As they get adopted into the Linux kernel mainline, they will also work with KVM.

Migration

KVM supports offline and live migrations. For example, when the host server is offline for maintenance, use KVM to migrate VMs to another host.

Live migrations require no downtime if the host and target servers use CPUs from the same manufacturer. Alternatively, you will first need to shut down an instance to move VMs from one host to another using different CPU manufacturers. In this case, some features may or may not work, depending on the CPU.

Security

KVM uses SELinux and sVirt to isolate virtual instances and protect the guest systems from various attacks. It also benefits from regular security updates to the kernel. Patches and updates are quickly released if anything goes wrong. Furthermore, the source code is transparent and regularly tested for suitability due to the collaborative approach to work done on the kernel.

Wrapping Up

This article briefly explained the Linux Kernel-Based Virtual Machine.

If your needs require using KVM, Liquid Web has many available hosting solutions that support it, including dedicated servers and server clusters, which are great for scaling your business. Contact our sales team to learn more about our offerings.

Avatar for Thomas Janson

About the Author: Thomas Janson

Thomas Janson joined Liquid Web's Operations team in 2019. When he is not behind the keyboard, he enjoys reading books, financial statements, playing tennis, and spending time outdoors.

Latest Articles

How to use kill commands in Linux

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article