Hyper-V Replica provides protection to VMs by tracking and replicating changes to the virtual hard disks (VHDs) of the VM. Hyper-V Replica runs 24 hours, 365 days in a year; for any VM that has been enabled for replication it ensures that the data on the primary site and the Replica site are kept as closely in sync as supported.
To begin with, Hyper-V Replica (HVR) requires that the data on the virtual hard disks (VHDs) of the primary and replica VMs be the same. This is achieved through the process of initial replication, and establishes a baseline on which replicated changes can be applied. However, due to factors beyond the control of the administrator – such as faulty hardware and OS bugchecks – it is possible that the primary and Replica VMs are not in sync.
Thus in a rainy day scenario (details in following section), when HVR determines that the replica VM can no longer be kept in sync with the primary by applying the replicated changes then resynchronization is required. Resynchronization (or Resync) is the process of re-establishing the baseline – by ensuring that the primary and replica VHDs have exactly the same data stored.
(NOTE: In this post we will use a VM named “RESYNC VM” in all examples and screenshots.)
It would become quite obvious after going through this table below that Resync is not expected to occur regularly. In fact, in the normal course of replication this is quite a rare event. The VM enters the “Resynchronization Required” state when any one of the conditions are encountered:
Site | Condition | Scenario example |
Primary |
Modify VHD when VM is turned off |
Mount/modify VHD outside the VM, Edit disk, Offline patching |
Primary |
Size of tracking log files > 50% of total VHD size for a VM |
Network outage causes logs to accumulate |
Primary |
Write failure to tracking log file |
VHD and logs are on SMB and connectivity to the SMB storage is flaky. |
Primary |
Tracking log file is not closed gracefully |
Host crash with primary VM running. Applicable to VMs in a cluster also. |
Primary |
Reverting the volume to an older point in time Reverting the VM to an older snapshot |
Volume/snapshot backup and restore |
Secondary |
Out-of-sequence or Invalid log file is applied |
Restoring a backed-up copy of the Replica VM Importing an older VM copy, when migration by using export-import Reverting volume to an older point in time using Volume backup and restore. Reverting the VM to an older snapshot |
When the VM enters the “Resynchronization Required” state, the replication health becomes “Critical” and the VM is scheduled for resynchronization. At the same time, HVR stops tracking the guest writes for the VM and nothing is replicated.
The replication health will also show this message:
Depending on the VM setting, the user might have to trigger the resynchronization operation explicitly. When that is required, follow the instructions as given in the replication health screen:
You will be presented with the screen to schedule the resynchronization operation:
To start the resync operation from PowerShell, use the Resume-VMReplication commandlet:
User-initiated resynchronization is also possible, but unless absolutely necessary it should be avoided. In order to explicitly force resynchronization on a VM that is not in the “Resynchronization Required” state, first suspend the replication and then initiate resync:
The scheduling of the resynchronization operation can be configured for each VM:
The default option is to schedule the resynchronization operation during off-peak hours. The resource intensive nature of the operation makes such scheduling useful, and aims to reduce the impact on running VMs.
The same can be configured in PowerShell using the Set-VMReplication commandlet:
To see the resynchronization settings in PowerShell, use the Get-VMReplication commandlet and look for the AutoResynchronizeEnabled , AutoResynchronizeIntervalStart , and AutoResynchronizeIntervalEnd fields:
When the resync operation is triggered – either automatically or by the user – the following high-level sub-operations are executed in sequence:
Resynchronization performance was tested and compared against the performance of Online Initial Replication (IR). The setup consisted of a standalone server with 4 running VMs – 2 File Servers and 2 SQL servers running typical workloads. Two VMs were replicated to a standalone Replica server. The network bandwidth was varied to see the impact. Data size that was replicated during Online IR was approximately 80GB.
Network speed | Online IR size | Online IR time | Resync size | Resync time | |
Resync – offline scheduling | 1 Gbps | ~80 GB | ~1.5 hrs | ~5.5 GB | ~2 hrs |
Resync – immediate | 1 Gbps | ~80 GB | ~1 hr | ~100 MB | ~1 hr |
Resync – offline scheduling | 1.5 Mbps | ~80 GB | 4 days | ~10 GB | ~1 day |
Resync – immediate | 1.5 Mbps | ~80 GB | 4 days | ~ 78 MB | ~1 hour |
The tests indicate that resync is preferable to Online IR in low speed networks. When the two sites are connected by a high speed network, resync works well for low churn workloads.
There is also a perfmon counter for measuring the resynchronized bytes: \Hyper-V Replica VM\Resynchronized Bytes .
The disks going out of sync is a rainy-day event in Hyper-V Replica. However with the Resynchronization operation, this is handled gracefully within the product to optimize the administrative overhead and the resources used in bringing the disks back into sync.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.