Freigeben über


How does Storage Migration actually work?

Now that I have showed you how to perform a storage migration of a running virtual machine in Windows Server “8” (both through Hyper-V manager and through PowerShell) an obvious question you might have is: but how does this actually all work?

The process followed by Hyper-V internally to perform a storage migration is actually quite simple to explain (though obviously quite tricky to actually make work in code) and is as follows:

Step 1: We start with a virtual machine that is reading and writing to a virtual hard disk file (.VHDX in the diagram, but storage migration is supported for both .VHDX and .VHD files).

image

Step 2: After the user selects to perform a storage migration, we immediately create a new virtual hard disk in the requested destination.  We continue to read and write to the source virtual hard disk – but any new write operations are also mirrored to the new virtual hard disk.

image

Step 3: We perform a single single pass operation to copy the data from the source virtual hard disk to the destination virtual hard disk.  While this copy is happening we still continue to mirror writes to both disks.  We also keep track of uncopied blocks that have already been updated through a mirrored write – and make sure to not needlessly copy that data again.

image

Step 4: Once the copy operation is complete – we switch the virtual machine to be running only on the destination virtual hard disk.

image

Step 5: We delete the source virtual hard disk and the migration is now complete.

image

One important note to make here – we are very careful to not delete the source virtual hard disk until after the virtual machine is successfully running on the destination virtual hard disk.  This way if there is an error at any point in the storage migration – we can always fail back to running off of the source virtual hard disk.

Cheers,
Ben

Comments

  • Anonymous
    March 14, 2012
    For those interested in the technical details and implications of this design, I can recommend the following paper (from vmWare): static.usenix.org/.../Mashtizadeh.pdf They list two alternatives to IO mirroring they explored and show that IO mirroring is the best solution for the tested workloads.

  • Anonymous
    March 14, 2012
    Deiruch - Yes, we were pleasantly surprised when VMware came out and announced that in vSphere 5.0 they were changing to using IO mirroring - which we were already well on the way to having done - as our internal analysis had shown that it was the most effective approach to use. Cheers, Ben

  • Anonymous
    March 14, 2012
    Great! This is a gratifying feature. :)

  • Anonymous
    April 17, 2012
    Thanks for the technology, thanks for the information Very helpful.