Live Migration: What It Is and How It Works
In this article
Live migration is the process of moving a running virtual machine (VM) or container from one physical host to another without shutting it down or interrupting its services. The guest operating system and its applications continue running, and the switchover is typically imperceptible to users. It is a core feature of hypervisors like VMware vSphere, Microsoft Hyper-V, KVM, and Xen, and it is also used in container orchestration platforms. The term is standard in IT infrastructure and cloud computing, not slang or informal. Its origin comes from combining “live” (meaning active or running) with “migration” (from the Latin migratio, meaning movement from one place to another). In practice, you would say: “We use live migration to move VMs to a new server during hardware maintenance without downtime.”
Why Live Migration Exists
Live migration solves a practical problem: physical servers need maintenance, upgrades, or decommissioning, but taking a VM offline means downtime for users and applications. Before live migration, administrators had to schedule maintenance windows, shut down VMs, move their files, and restart them—causing service interruptions. Live migration enables:
- Zero-downtime hardware maintenance and upgrades
- Load balancing across hosts when one server becomes saturated
- Proactive evacuation of VMs before a predicted hardware failure
- Energy savings by consolidating VMs onto fewer hosts during low usage
The technique was first demonstrated in the early 2000s with Xen and later refined by VMware and other vendors. It has become a standard feature in enterprise virtualization and cloud data centers.
How Live Migration Works
Live migration relies on copying the VM’s memory state from the source host to the destination host while the VM keeps running. The process generally follows these steps:
- Pre-copy phase: The hypervisor begins copying the VM’s memory pages to the destination host. The VM continues running on the source, so any memory pages that change during the copy are marked as dirty.
- Iterative copying: The hypervisor repeatedly copies the dirty pages. Each pass copies fewer pages because the VM’s active working set is smaller than its total memory. This continues until the remaining dirty set is small enough to transfer in one final burst.
- Stop-and-copy (or switchover): The VM is paused briefly (usually for less than a second), the remaining dirty pages are copied, and the VM state is transferred to the destination.
- Resume: The VM resumes on the destination host. The network connection is redirected, and the source host cleans up the now-empty VM.
For storage, live migration can either copy the VM’s virtual disk files to the destination (storage migration) or use shared storage (like SAN or NAS) so that only memory needs to be transferred. Network connectivity is maintained by preserving the VM’s IP address, often using MAC address spoofing or a virtual switch that forwards traffic to the new location.
Types of Live Migration
There are several variations, each suited to different scenarios:
- Cold migration: The VM is shut down, moved, and restarted. This is not live migration because it involves downtime, but it is simpler and works across different storage types.
- Warm migration: The VM is paused, its state is copied, and then it is resumed on the destination. The pause is longer than in live migration but shorter than a full shutdown.
- Live migration with shared storage: The VM’s disk files are on shared storage, so only memory is transferred. This is the most common and fastest method.
- Live migration without shared storage: Also called “storage vMotion” or “live storage migration,” this copies the disk files as well as memory, which is slower but allows moving between hosts with different storage.
- Live migration of containers: In container orchestration (like Kubernetes), live migration is less common because containers are typically ephemeral and can be restarted elsewhere. However, some tools support checkpoint and restore for stateful containers.
Requirements and Limitations
Live migration is not automatic—it requires specific conditions to work reliably:
- Compatible CPUs: The source and destination hosts must have compatible CPU features. If they differ, you may need to enable CPU masking (like VMware’s Enhanced vMotion Compatibility) to hide newer instructions from the VM.
- Sufficient network bandwidth: Memory transfer uses network bandwidth. A 10 Gbps link is often recommended for large VMs. Slow networks can cause the migration to take longer and increase the chance of failure.
- Shared storage (optional but common): If not using shared storage, the disk files must be copied, which adds time and requires adequate storage performance.
- Resource availability: The destination host must have enough CPU, memory, and storage to accommodate the VM.
- No unsupported devices: Some hardware passthrough devices (like GPUs or USB controllers) may not support live migration because they are directly attached to the physical host.
Common problems include migration failures due to network timeouts, CPU incompatibility, or insufficient memory on the destination. Most hypervisors provide logs and pre-checks to catch these issues before starting the migration.
How to Choose a Live Migration Method
Choosing the right approach depends on your environment and goals:
- If you have shared storage (SAN, NAS, or a clustered filesystem), use standard live migration—it is fastest and causes the least impact.
- If you are moving VMs between hosts with different storage, use storage migration, but plan for longer transfer times and ensure the destination storage has enough space.
- If you are migrating between hosts with different CPU generations, enable CPU compatibility masking to prevent the VM from crashing after migration.
- For large memory VMs (over 100 GB), consider using a dedicated migration network to avoid saturating the production network.
- If you are doing maintenance, migrate VMs one at a time to avoid overloading the destination host.
Safety and Best Practices
Live migration is generally safe, but following best practices reduces risk:
- Always verify that the destination host has enough resources (CPU, memory, storage) before starting the migration.
- Use a dedicated network for migration traffic if possible, to avoid impacting production traffic.
- Test migrations in a lab environment before using them in production.
- Monitor the migration progress; if it fails, the VM should remain on the source host (most hypervisors handle this automatically).
- For critical VMs, ensure that the destination host is healthy and has redundant power/network.
- Do not migrate a VM that is under extreme load unless necessary; the migration may take longer and increase the chance of failure.
There is no risk of data loss during a successful live migration because the VM’s state is fully copied before the switchover. However, if the network fails during the final switchover, the VM may be paused or fail to resume—most hypervisors will attempt to abort the migration and keep the VM running on the source.
Alternatives to Live Migration
Live migration is not always the best tool. Alternatives include:
- High availability (HA): If a host fails, the VM is automatically restarted on another host. This involves downtime (usually a few minutes) but requires no pre-planning.
- Fault tolerance: A secondary VM runs in lockstep with the primary, providing near-zero downtime, but it doubles resource usage and has limitations on CPU and disk I/O.
- Application-level replication: For databases or stateful services, you can replicate data to a standby node and fail over manually or automatically.
- Container restart: In cloud-native environments, restarting a container on another node is often simpler than live migration, especially if the container is stateless.
Frequently Asked Questions
Does live migration cause downtime?
No, live migration is designed to have zero or near-zero downtime. The VM is paused for only a fraction of a second during the final memory copy. Users typically do not notice any interruption, though very sensitive real-time workloads might see a slight delay.
Can I live migrate a VM with a GPU?
It depends. If the GPU is passed through directly (PCIe passthrough), live migration is usually not supported because the VM is tied to that physical hardware. Some hypervisors support GPU virtualization (like NVIDIA vGPU) that allows migration, but it requires compatible hardware and configuration.
What happens if the destination host runs out of memory during migration?
The migration will fail. The hypervisor will abort the migration and the VM will remain running on the source host. To avoid this, check the destination host’s free memory before starting, and consider using memory overcommitment with caution.
Is live migration the same as vMotion?
vMotion is VMware’s brand name for live migration. Other vendors have their own names: Hyper-V calls it “Live Migration,” KVM calls it “Migration,” and Xen calls it “Live Migration.” The underlying concept is the same.
Can I live migrate a VM across different data centers?
Technically, yes, but it requires high-speed, low-latency network links between the data centers. The memory copy must complete within a reasonable time, and the storage must be accessible from both locations. In practice, it is rarely done across long distances due to network latency and bandwidth constraints.