Skip to content
hostcomplex

Live Migration of VMs

Maarten Soetens 3 min read

How Live Migration Moves a Running Machine

Live migration is the process of moving a running virtual machine from one physical host to another without shutting it down. Users keep working, and the guest operating system does not reboot. The VM typically pauses for only a very short moment at the end of the move.

The hard part is memory. A VM may have many gigabytes of RAM, and much of it changes constantly while the VM runs. Most hypervisors use pre-copy migration. They copy all of the memory to the destination while the VM keeps running, then repeatedly copy the pages that changed in the meantime. Each round has less data to send, because fewer pages change between rounds.

When the remaining changes are small enough, the hypervisor pauses the VM briefly, copies the last pages and the processor state, and resumes the VM on the destination host. VMware calls its version vMotion on VMware ESXi hosts, and Microsoft Hyper-V and KVM offer their own live migration features.

What Live Migration Requires

Live migration depends on a few conditions. The disk must be reachable from both hosts, usually because both use shared storage, such as a storage area network (SAN) or a network file system. Alternatively, the disk can be copied during the move, which takes longer.

The network must look the same to the VM. The destination host has to connect the VM to a network that carries its traffic, so it keeps its IP address and open connections. This is why live migration and virtual networking are closely linked: the virtual switch or VLAN on the destination must match the one the VM used.

The processors on both hosts must also offer compatible features. A VM that has started using newer processor instructions may refuse to move to a host with an older processor. Hypervisors offer CPU compatibility modes that hide the differences, at a small cost in available features.

Example: Moving Customers Off a Host Before Maintenance

A provider needs to replace a failing memory module in one physical host. Without live migration, every customer VM on that host would have to be shut down, causing downtime for every site and application it runs. With live migration, the provider moves the VMs one at a time to other hosts, and customers see at most a brief pause. Once the host is empty, the repair can happen without affecting customers.

The same technique helps with load balancing. If one host is busy and another is idle, VMs can be moved to spread the work more evenly.

Frequently asked questions

Does live migration cause downtime?

Usually only a very short pause. The VM is paused at the end of the migration while the last changes are copied, and then it resumes on the new host. Users typically notice at most a brief delay, and open connections often continue. Very busy VMs whose memory changes quickly can take longer to migrate.

What is the difference between live migration and failover?

Live migration is planned: the source host is healthy and the move is coordinated. Failover, often part of high availability features, restarts a VM on another host after the original host has failed. Because failover is a restart, the VM's memory state is lost, while live migration keeps the running state intact.

  • Two-Factor Authentication

    Two factor authentication hosting adds a second check to control panel, domain and CMS logins. Learn which methods are strongest and why 2FA helps.

  • What Is an A Record?

    What is an A record? Learn how this DNS record maps a hostname to an IPv4 address, why domains use several A records and the root and www pattern.

  • Billing and Automation Platforms

    What is WHMCS? Learn how this commercial billing and automation platform helps hosts sell plans, collect payments and create accounts automatically.