If you need to take a host offline for maintenance, you can move the virtual machine to another host. Migration with vMotion™ allows virtual machine processes to continue working throughout a migration.
With vMotion, you can change the host on which a virtual machine is running, or you can change both the host and the datastore of the virtual machine.
When you migrate virtual machines with vMotion and choose to change only the host, the entire state of the virtual machine is moved to the new host. The associated virtual disk remains in the same location on storage that is shared between the two hosts.
When you choose to change both the host and the datastore, the virtual machine state is moved to a new host and the virtual disk is moved to another datastore. vMotion migration to another host and datastore is possible in vSphere environments without shared storage.
After the virtual machine state is migrated to the alternate host, the virtual machine runs on the new host. Migrations with vMotion are completely transparent to the running virtual machine.
The state information includes the current memory content and all the information that defines and identifies the virtual machine. The memory content includes transaction data and the bits of the operating system and applications that are in the memory. The defining and identification information stored in the state includes all the data that maps to the virtual machine hardware elements, such as BIOS, devices, CPU, MAC addresses for the Ethernet cards, chip set states, registers, and so forth.
When you migrate a virtual machine with vMotion, the new host for the virtual machine must meet compatibility requirements so that the migration can proceed.
Below are the steps :
- The first step is to ensure that the source VM can be operated on the chosen destination server (same CPU architecture and make sure you configure a vMotion Network else it operates on Management network of a host).
- Then a second VM process is started on the target host and the resources are reserved.
- Next, a system memory checkpoint is created. This means all changes to the source VM are written to an extra memory area.
- The contents of the system memory recorded at the checkpoint are transferred to the target VM(on the destination host).
- The checkpoint/checkpoint-restore process is repeated until only the smallest change sets remain in the target VM’s memory.
- The CPU of the source VM is stopped.
- The last modifications to the main memory are transferred to the target VM in milliseconds.
- The vMotion process is ended and a reverse ARP packet is sent to the physical switch (important: Notify Switches must be activated in the properties of the virtual switch). Hard disk access is taken over by the target ESX.
- The source VM is shut down. This means the VM process on the source ESXi is deleted.
A very good article on troubleshooting VMotion issue is Understanding and troubleshooting vMotion (1003734)