More Lessons Learned from Hyper-V Replica

In my previous post on lessons learned from Hyper-V Replica, I introduced the features of Hyper-V Replica introduced in Windows Server 2012 and improved in Windows Server 2012 R2. We saw that while Hyper-V Replica is a great feature, like all other technologies, it requires a workflow along with monitoring and troubleshooting procedures. In this post, I will discuss the workflow of implementing replication on an individual VM.

If there’s one thing that we can all agree on, it is that we should organize our VM configuration and virtual hard disk files in an orderly way (OCD FTW). If there’s one thing we can’t all agree on is how do that. The default way which Microsoft organizes Hyper-V VM’s is by placing the configuration file within one folder and placing the virtual hard disks within a separate folder.

hypervreplica001

hypervreplica002

Having the configuration files and VHD(X) files in separate locations doesn’t seem very tidy to me. I have opted to create a single folder to hold both configuration files and VHD files, naming the folder with the name of the VM. I then named the associated VHD files with the server name and drive letter as appropriate.

hypervreplica003hypervreplica004This organization makes it easier to locate all the files associated with a VM for administration, migration, backups, and other duties to which you might be called.

Tip: If you’re creating a VM from the GUI check the “Store the virtual machine in a different local” box and specify the folder, then all your configuration and VHD files will be stored in that one folder with the folder named as the VM name.

hypervreplica005

We spent all this time organizing our VM files into orderly folders, so the assumption would be that when you enable replication for the VM your orderliness will be mirrored to the replica host. Well you know what assuming does…Here’s what really happens.

When establishing initial replication the replica server creates separate folders for configuration and VHD files using GUID‘s as the folder names.

hypervreplica006

I’m sure there was good reasoning behind this decision but for those of us with CDO (that’s OCD in alphabetical order) we like to keep things organized.  Fortunately a simple storage migration on the replica server will get us back to OCD nirvana ensuring everything is in its place.

When first establishing replication for a VM allow the Hyper-V server to create the replica folders where it wants, but do not initiate replication immediately. Instead set the replication for a future time. hypervreplica007Then create a folder with the name of your choosing and perform a storage migration of the placeholder files. hypervreplica008Then initiate the replication. hypervreplica009hypervreplica010Now your replica VM files will be nice and tidy.

Now that we now have an understanding of the Hyper-V files and folder structure for both primary and replica VM’s, we can implement processes and procedures for deploying Hyper-V VM replicas. With this knowledge we can develop PowerShell scripts to automate these processes to free up your engineers and administrators for other duties.