Hyper-V: Moving virtual machine storage with no downtime.

In this post I will try to explain this feature of Windows Server 2012 as simply as possible.

Windows Server 2008 R2 allowed you to move a running instance of a virtual machine using live migration, but did not allow you to move the virtual machine’s storage while the virtual machine was running.

Hyper-V in Windows Server 2012 introduces a unique support for moving virtual machine storage without downtime  by making it possible to move the storage while the virtual machine remains running. You can perform this task by using a new wizard in Hyper-V Manager or by using new Hyper-V cmdlets for Windows PowerShell.

You can add storage to either a stand-alone system or to a Hyper-V cluster and then move virtual machines to the new storage while the virtual machines continue to run.

The most common reason for moving a virtual machine’s storage is  to update the physical storage that is available to Hyper-V.  You can also move virtual machine storage between physical storage devices, at runtime, to respond to reduced performance that results from bottlenecks in the storage throughput as program requirements rises or the VM becomes a high IOPS VM.

 

Technical Overview

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This new feature allows you to move the virtual hard disks of a virtual machine while those virtual hard disks remain available for use by the running virtual machine. When you move a running virtual machine’s virtual hard disks, Hyper-V performs the following steps in the background:


  1. Throughout most of the move operation, disk reads and writes go to the source virtual hard disk.
  2. While reads and writes occur on the source virtual hard disk, the disk contents are copied  to the new destination virtual hard disk.
  3. After the initial disk copy is complete, disk writes are mirrored to both the source and destination virtual hard disks while outstanding disk changes are replicated.
  4. After the source and destination virtual hard disks are completely synchronized, the virtual machine switches over to using the destination virtual hard disk.
  5. The source virtual hard disk is then becomes orphaned and finally gets deleted.

Requirements

Moving virtual machine storage is a feature of Hyper-V.  In order to use this functionality you need:

  • One or more “Windows Server 2012” installations; standard or datacenter both editions has this feature
    • The Hyper-V role installed, which requires a server that is capable of running Hyper-V.  Specifically, it must have processor support for hardware virtualization. For Intel this support is called VT-x; a processor virtualization support.
  • To use Windows PowerShell to move virtual machine storage,  the new Windows PowerShell cmdlets for Hyper-V  must be imported first, so your command prompt be ready for using the Hyper-V commandlets. These new cmdlets are available for import after you install the Hyper-V role. For more information about the cmdlets, see “Hyper-V cmdlets for Windows PowerShell”.
  • Virtual machines that are configured to use  only virtual hard disks for storage.
    • You cannot move the storage of a virtual machine  when any of its storage is directly attached to a physical disk.

Summary

Hyper-V in Windows Server 2012 makes it possible to move the storage while the virtual machine remains running.