To resume a broken replication between two Hyper-V hosts where the old replication IDs are lingering on the receiving host, you can manually remove these "ghost" replication records from the receiving host to allow a fresh replication setup.
Here’s a step-by-step guide:
Step 1: Stop the Current Replication (if partially working)
If the replication is in a failed state but still visible, stop it using the Hyper-V Manager or PowerShell:
-
Using Hyper-V Manager:
- Open Hyper-V Manager on the receiving host.
- Right-click on the replicated virtual machine.
- Select Replication > Remove Replication.
-
Using PowerShell:
Stop-VMReplication -VMName "YourVMName"
Remove-VMReplication -VMName "YourVMName"
Step 2: Check for Remaining Replication Metadata
The replication metadata may not have been fully cleaned, and this is where the ghost IDs can still reside.
- Open PowerShell on the receiving host.
- Run the following command to check for any replication metadata that may still exist:
Get-WmiObject -Namespace root\virtualization\v2 -Query "Select * from Msvm_ReplicationServiceSettingData"
This command will list any remaining replication settings, including the Replication Relationship
information.
Step 3: Remove Stale Replication Data (via WMI or PowerShell)
If you find replication entries related to the ghost replication setup, remove them using:
-
Delete the stale replication object using PowerShell:
Get-WmiObject -Namespace root\virtualization\v2 -Query "Select * from Msvm_ReplicationServiceSettingData" | Remove-WmiObject
-
Clear VMMS Replication Configuration: Sometimes the configuration for replication might persist in the VMMS service. You can reset this by restarting the Hyper-V Virtual Machine Management service (VMMS):
Restart-Service vmms
Step 4: Clean Up the Hyper-V Replica Broker Configuration (if used in a cluster)
If you're using Hyper-V Replica in a cluster environment, check the Hyper-V Replica Broker role for any stale configurations:
- In Failover Cluster Manager, go to Roles and look for the Hyper-V Replica Broker.
- Remove any stale VM replication configurations that are linked to the failed replication attempt.
Step 5: Recreate the Replication
After cleaning up the old replication settings, you should be able to start a fresh replication setup. You can use either the Hyper-V Manager or PowerShell:
-
Using Hyper-V Manager:
- Right-click the VM > Replication > Enable Replication.
-
Using PowerShell:
Start-VMInitialReplication -VMName "YourVMName"
This should clear any lingering issues from the old replication and allow you to set up a new replication without conflict.