Freigeben über


Replicating Virtual Machines to Multiple Folders

Hyper-V Replica allows you to configure where replicated virtual machines will be stored.  You can either choose to have all replicated virtual machines stored in a single location, or you can choose to specify a separate location for each primary server that is replicating to you.

But what if you need to have multiple virtual machines replicating from a single primary server, but stored on different drives?

This is what I needed to do for my home configuration.  It turns out that while the solution is not obvious, it is not that hard to do.  What you need to do is:

  1. Configure Hyper-V Replica to store the replicated virtual machines in one of the locations you will be using
  2. When you enable replication on a virtual machine that needs to be stored in a different location, choose to perform initial replication at a later point in time:
    rep1      
    This will mean that only the configuration file and some placeholder virtual hard disk files will be created at this stage (all of which are very small)
  3. Go to the replica server and find the virtual machine in question
  4. Choose to move the virtual machine
  5. Move the virtual machine storage to the location that you want for the replica
    rep3
  6. Return to the primary server and choose to start initial replication
    rep4
  7. This time choose to start replication immediately
    rep5

When you are done you will have the virtual machine replicating to a unique location.

Cheers,
Ben

Comments

  • Anonymous
    September 28, 2013
    This is EXACTLY what I've been doing except a MUCH better approach. I have a setup which is more or less the same as yours (Inspired by yours to be honest). I have 2 hosts at home using replication to keep me online if one host needs some maintenance. The biggest difference between our setups is the disk configuration. I'm using multiples of RAID1/Mirror where you are using a single large Raid5/Parity. Regarding replication: My approach was to enable replication and start it immediately. Then perform the move command on the replica server after the VM had been replicated. This of course took a long time on my file server as it's about 1TB in size. Your approach of enabling replica, then moving the machine on the replica server and finally starting the replication process is something i should have thought about, but didn't. This couldn't have come at a better time as I'm about to start to replicating some large VMs. Thank you for the tip Ben :). Awesome stuff Jack.

  • Anonymous
    February 05, 2014
    Wonderful article but what if we use CSV for replication , In fail-over there isn't any option to select multiple csv for replication . Regards, Muzammil Ahmed email : muzammil8t6@gmail.com

  • Anonymous
    July 24, 2014
    The comment has been removed

  • Anonymous
    September 17, 2014
    I'm running 2 Hyper-V Server 2012 R2's, and I got the message; "Cannot change the settings for the virtual hard disk because it is enabled for replication" To get it to work, I had to remove replication on both the replicated virtual machine and the original one. Then I moved the location of the hard disk on the replication machine, and reconfigured replication on the original one and it used the machine created in the previous replication step, with the changed locations.

  • Anonymous
    July 04, 2016
    This is excellent, works perfectly. I am replicating from a stand-alone hyper-v host to a hyper-v cluster. I wanted to choose alternate CSV paths for the multiple VHDX files I have per VM.

  • Anonymous
    October 03, 2016
    This was useful, but not really complete, in my experience. I'm using the free plain Hyper-V 2012 (not R2).I needed to move specific disks (on a multiple-disk VM) to different locations.What worked for me:- create the replication with suspended first-replication as taught in the article- some dummy disks get created by Hyper-V (sort of placeholders until the initial replication begins)- use Powershell, not the GUI, to move the disks on the Replica with something like this:Move-VMStorage -VMName somename -Vhds @{"SourceFilePath"="F:\VHD\C.vhdx";"DestinationFilePath"="E:\VMStorage\C.vhdx"}- make sure the permissions for the new folders and files are correct with something like this:icacls E:\VMStorage /t /grant "NT VIRTUAL MACHINE\9E583EA1-3D01-4F76-B59E-2DC6245C04EA":(F)- move the Snapshot location also, if needed:get-vm somename | Move-VMStorage -SnapshotFilePath E:\Snapshots - now start initial replicationThis solution helped me escape that mortal sequence where I can't move the disks because they are locked for replication, and I also couldn't get a newly created replication to use the files from a previous replication after I tweaked it (as in Jay's example, which didn't work for me).