Windows Server 2016 #HyperV DEMO02: Hyper-V Replica Support For Hot Add/Remove of VHDX

Hello folks,

Today I will demo another new big operational feature in Windows Server 2016 Hyper-V, Hyper-V Replica support for Hot Add and Remove of Virtual Hard Disk.

Microsoft added the ability to hot add and remove virtual hard drive to virtual machines that was being replicated. This is fantastic! Why? Because in Windows Server 2012 or 2012 R2, if we add a virtual hard disk to a virtual machine that was being replicated, then the replication would fail, and the replica will go into a critical state. Sad smile

In Windows Server 2016 that doesn’t happen anymore, when you add a virtual hard drive to a virtual machine it doesn’t get automatically added to the replications set, but the replication will continue to work just fine, and at any stage while the virtual machine is still running and replicated, you can actually go in and use a simple PowerShell cmdlet to add or remove virtual hard drive from the replication disks set, and then Hyper-V Replica will automatically re-synchronize and everything works as expected. Open-mouthed smile

Thank you Microsoft for making Hyper-V Replica experience a lot more seamless.

To add and update the new virtual hard disk to the replica disk set, you will run the following cmdlet:

To remove any virtual hard disk from the replica disk set, you actually use the same PowerShell cmdlet above, but instead of passing all the disks into ReplicatedDisks – you pass in just the disks that you want to replicate, and exclude the ones that you want to remove.

Let’s look together at the Hyper-V Replica enhancement in action!

DEMO:

I hope you enjoyed the demo, and I would like to thank you for viewing.

Cheers,
/Charbel

About Charbel Nemnom 380 Articles
Charbel Nemnom is a Microsoft Cloud Solutions Architect, totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 17 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

4 Comments

  1. Hi Charbel

    I am replicating a server to our disaster recovery site. I now have 2 additional huge VHDX-Files, which I want to replicate. I managed to add them to the existing replica, but it will replicate those two VHDX into the same CSV in our DR site. It will not fit into this CSV. I prepared 2 seperate CSVs, where only the replication of this two WHDX will reside. How can I change the destination folder of this VHDX files, if I include them into the existing replication? I tried to delete and re-create the replication and moved the empty VHDX files to the defined CSVs, but the initial replication will fail because the disks are not visible (as moved before initial replication). How could I manage this situation? (All Windows Server 2016)
    Thank you!
    Regards, Zafer

    • Hello Zafer,

      Thank you for the comment.

      You could leverage Hyper-V storage resource pools. Hyper-V storage resource pools allow you to remove path details from the virtual machine configurations.

      What you need to do is the following:

      1- Create a storage resource pool – with the same name on each node in the cluster (Primary Site).
      2- Configure the storage resource pool to point to the right storage path for each node (Primary and Secondary site).
      3- Configure the replicated virtual machines to utilize this storage resource pool.

      The storage Pool is created using PowerShell:

      On all nodes in the cluster on the PRIMARY site, you want to run this command:

      New-VMResourcePool -Name “VHDs” -ResourcePoolType VHD -Paths “C:\ClusterStorage\LUN-Name-A”

      Then on all nodes in the cluster on the SECONDARY site, you want to run this command:

      New-VMResourcePool -Name “VHDs” -ResourcePoolType VHD -Paths “ClusterStorage\LUN-Name-B”

      Once you have configured these storage resource pools – the Hyper-V UI will magically detect them.
      Now when you go to configure each virtual hard drives, you see a resource pool option named (i.e. VHDs).

      Once you have selected the appropriate resource pool on both sides, you can start the replication.

      Hope this helps and let me know how it works for you.

      Cheers,
      -Charbel

  2. Hi Charbel

    Thank you for your answer.
    I am not able to add another resource pool as there is no free space.
    We have 4 CSV (2 reserved for the 2 big disks) on both sides. On the primar site the VMs system disk is on CSV 2, the big Disks are on CSV 3 and CSV 4. The same CSVs do exist on the DR site. I need to be able to run the Replication to exactly these CSVs from the beginning. Is this possible?

    Regards,
    Zafer

    • Hello Zafer,

      I did not understand that you cannot add another resource pool as there is no free space.
      You don’t need free space to add a Storage Resource Pool. You can add a Storage Resource Pool to an exiting LUN/Storage/Volume.

      In you example above, you can do the following:

      On all nodes in the cluster on the PRIMARY site, you want to run this command:

      New-VMResourcePool -Name “SystemDisk” -ResourcePoolType VHD -Paths “C:\ClusterStorage\CSV2\”
      New-VMResourcePool -Name “BigDisk01” -ResourcePoolType VHD -Paths “C:\ClusterStorage\CSV3\”
      New-VMResourcePool -Name “BigDisk02” -ResourcePoolType VHD -Paths “C:\ClusterStorage\CSV4\”

      And then for that particular VM, you need to specify the storage resource pool for each and every virtual hard disk (VHDX).

      On the second DR site, you need to do the same (run the same cmdlets).

      Hope this helps and let me know how it works for you.

      Cheers,
      -Charbel

This site uses Akismet to reduce spam. Learn how your comment data is processed.