You dont have javascript enabled! Please enable it! Windows Server 2016 HyperV DEMO02: Hyper-V Replica Support For Hot Add/Remove Of VHDX - CHARBEL NEMNOM - MVP | MCT | CCSP | CISM - Cloud & CyberSecurity

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

1 Min. Read

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 the virtual hard drive to virtual machines that were 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 the 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:

Set-VMreplication VMName -ReplicatedDisks (Get-VMHardDiskDrive VMName)

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.

Set-VMreplication VMName -ReplicatedDisks (Get-VMHardDiskDrive VMName –ControllerLocation 0 –ControllerNumber 0)

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


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


Photo of author
About the Author
Charbel Nemnom
Charbel Nemnom is a Senior Cloud Architect with 21+ years of IT experience. As a Swiss Certified Information Security Manager (ISM), CCSP, CISM, Microsoft MVP, and MCT, he excels in optimizing mission-critical enterprise systems. His extensive practical knowledge spans complex system design, network architecture, business continuity, and cloud security, establishing him as an authoritative and trustworthy expert in the field. Charbel frequently writes about Cloud, Cybersecurity, and IT Certifications.

Windows Server 2016 HyperV DEMO01: Hot Add/Remove Memory and Virtual Network Adapters

Windows Server Hyper-V DEMO03: Production Checkpoints


8 thoughts on “Windows Server 2016 HyperV DEMO02: Hyper-V Replica Support For Hot Add/Remove of VHDX”

Leave a comment...

  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

  2. 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.


  3. 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?


  4. 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.


  5. Just a question:
    After configuring the same type of storage resource pools pointing one to one csv and one to another, what king of replication i need to enable in a stretch cluster configuration?
    Does not the system retrieve the same name storage resource pools and enable replication automatically?

  6. Hello Enrico,
    The system will not enable automatic replication for the storage, you have to configure Hyper-V replication and include all the disks set that you want to be part of the replication.
    Microsoft addressed Stretch cluster configuration in Azure Stack HCI OS, but if you are using an older OS (Windows Server 2016 or 2019), you have to configure Hyper-V replication asynchronous every (30 seconds, 5 or 15 minutes) as shown in the demo above. The VM could have multiple VHDX disks which can reside on multiple CSV(s) as well.
    Hope that helps.

  7. Hi Charbel, i’ve wrote you some times ago about stretch cluster storage resource pool replication.

    I succesfully achieve vm high availability in a stretch cluster configuration following the below guide:

    Storage replication between primary and secondary csv work pretty well (the only limitation is that replication is not active-active bidirectional, but active-passive monodirectional)

    problems arise when i need to configure the vm networking stack:
    i have two datacenter (primary and secondary) with different vlans and ip schema like below:

    Primary Datacenter
    – SERVER VLAN – VLAN 20, ip schema

    Secondary Datacenter
    – SERVER VLAN – VLAN 30, ip schema

    My needs is to avoid manual intervention to reconfigure the vm tcp stack when the vm failover from the primary to secondary datacenter
    automatically pick ip address, and vlan 20 in the primary datacenter
    automatically pick ip address, and vlan 30 in the secondary datacenter

    How can i achieve this?

    Thanks in advance

  8. Hello Enrico,
    Thanks for your comment. I am glad to hear that you have achieved VM high availability in a stretch cluster configuration.
    In regards to your question. You are using Hyper-V Failover Cluster and not Hyper-V Replica.
    As you know with Hyper-V Replica, we can configure the VM networking stack based on your site (IP schema) that will be used during failover.
    But since you are using Hyper-V Failover Cluster, I recommend to stretch VLAN’s in this case. You can span Layer 2 across both sites so the IP will never changes.
    If that is not possible, then you need to use a networking device that will abstract the underlying VM actual IPs. The networking device will use a 3rd IP which is the one registered in DNS and used by the client (user). Check Cisco example here.
    Hope this helps!

Let us know what you think, or ask a question...