5-min deep dive

vMotion in depth: how live migration works, DRS and HA

vMotion moves a running virtual machine to another server without stopping it. Inside, it uses a clever trick: copying memory that keeps changing “while chasing it.”

Reading time: about 5 min

← Start with the 1-min version

In the game, this was fixing a diner tablePlay “Fix the Table! Move the Guests”

In the gameIn real IT
Diner tableServer (ESXi host)
Table under repairHost going into maintenance
Group of guestsVirtual machine (VM)
People / platesvCPU / memory
Moving while still eatingvMotion
Feuding, so separate tablesSeparate-host rule

Copying memory “on the chase”

When moving a virtual machine (VM), the hardest part is the contents of memory, because they keep changing while it runs. vMotion proceeds like this:

  1. With the VM still running, copy all of its memory to the new host
  2. Copy again only the parts that changed during the copy (and repeat)
  3. Once the remaining changes are small enough, pause the VM for just an instant and copy the final difference and the CPU state
  4. Resume the VM on the new host and tell the network equipment “this VM is over here now”

The pause is usually under a second — about enough to delay one ping, if that. Users barely notice. VMs with hundreds of GB of memory are not unusual, so a dedicated network of 10 Gbps or more for the copying is standard.

Shared disks don’t need copying

The basic approach is to keep a VM’s disks (virtual disk files) on shared storage (SAN, NAS, vSAN and so on) visible to multiple hosts. Every host sees the same disks, so only the memory and CPU state need to move. To change where the disks themselves live, you use Storage vMotion.

EVC matches CPU compatibility

A VM runs assuming the CPU features (available instructions) it saw when it started. Move it from a host with a newer-generation CPU to an older one, and features it was using are missing. EVC solves this by presenting the whole cluster as having “the features of the oldest CPU.” You set it when mixing old and new servers. Note that vMotion isn’t possible between Intel and AMD CPUs.

DRS and HA: similar but different

DRSHA
When does it act?Normally (watching for uneven load)When a host fails
How does it move VMs?Moves them with vMotion, without stoppingRestarts them on another host
Do VMs stop?NoOnly for the time it takes to restart

VMs stop under HA because the failed host’s memory can no longer be read. The only option is to restart from the disks on shared storage. For VMs that must not stop even on failure, there’s also FT (Fault Tolerance), which always runs a shadow copy of the VM on another host at the same time — at the cost of twice the CPU and memory.

Field note: leave room with “N+1”

If you build a cluster of 4 hosts, keep one host’s worth of room free at all times so the remaining 3 can run every VM if one fails (N+1). HA admission control is the setting that blocks starting VMs that would eat into this room. When building an ESXi cluster on Dell PowerEdge, too, you check “will it still run if one host fails?” when deciding how many hosts to buy.

Practice questions

Four-choice questions in the style of Japan’s Fundamental Information Technology Engineer Examination. Tap below to see the answer.

Q1What is the technology called that moves a running virtual machine to another physical server without stopping it?

  • ALive migration
  • BFailover
  • CSnapshot
  • DCloning
Show the answer and explanation

Answer: ALive migration is the general name for moving a virtual machine while it runs; VMware calls it vMotion. Failover means switching to a standby when something fails, and a snapshot saves the state at a point in time.

Q2With vSphere HA, what correctly describes what happens to virtual machines when a host fails?

  • AThey move to another host without stopping
  • BThey are restarted on another host
  • CThey stay stopped until the failed host is repaired
  • DThey are deleted automatically
Show the answer and explanation

Answer: BHA restarts the VMs from the failed host on another host, from their disks on shared storage. So the VMs stop only for the time it takes to restart.

Q3In a cluster mixing hosts with CPUs of different generations, which feature makes vMotion possible?

  • AEVC
  • BDRS
  • CFT
  • DvSAN
Show the answer and explanation

Answer: AEVC presents the CPU features of every host in the cluster as those of the oldest generation. This allows vMotion between old and new hosts.

Summary
  • vMotion copies memory while chasing changes, then pauses for just an instant at the end
  • Keep disks on shared storage; match CPU compatibility with EVC
  • DRS moves VMs without stopping them; HA restarts them on another host (they stop once)