Skip to content

Disaster Recovery

Hyper-V Replica provides a robust mechanism for disaster recovery by replicating virtual machines (VMs) between primary and replica hosts. This section outlines procedures to execute and validate VM recovery using Hyper-V Replica and complementary backup strategies.


Pre-Recovery Checks

Before initiating recovery, verify the replication status and environment readiness:

1. Validate Replication Health
Use PowerShell to check replication status and ensure no errors:

Get-VMReplication | Format-List VMName, PrimaryServer, ReplicaServer, ReplicationState, LastReplicationStatus
Ensure ReplicationState is Connected and LastReplicationStatus shows no failures.

2. Confirm Network Connectivity
Test connectivity between primary and replica hosts:

Test-NetConnection -ComputerName <ReplicaServerFQDN> -Port 80
Ensure replication ports (TCP 80, 443, and 53) are open.

3. Check VM State
Ensure the VM is in a healthy state:

Get-VM -Name <VMName> | Select-Object VMName, State, ReplicationStatus


Initiating Failover

Failover can be planned (manual) or unplanned (automatic).

Planned Failover (Manual)
Switch the VM to the replica host:

Failover-VMReplication -VMName <VMName> -PrimaryServer <PrimaryServerFQDN>
This stops the VM on the primary and starts it on the replica.

Unplanned Failover (Automatic)
If the primary host fails, the replica VM automatically takes over. Ensure the replica VM is configured for automatic failover in the Hyper-V settings.

Switch Primary and Replica Roles
If the original primary is restored, reconfigure the VM:

Set-VMReplication -VMName <VMName> -PrimaryServer <RestoredPrimaryFQDN>


Validating Recovery

After failover, confirm the VM is operational:

1. Test Replication Consistency
Run:

Test-VMReplication -VMName <VMName> -ReplicaServer <ReplicaServerFQDN>
Verify data integrity and synchronization.

2. Check VM Functionality
Access the VM’s console and validate applications/services. Monitor system logs for errors:

Get-EventLog -LogName System -Newest 50 | Format-List

3. Network and DNS Verification
Ensure the VM’s IP address and DNS settings align with the new environment. Update DNS records if necessary.


Post-Recovery Steps

1. Document Recovery Actions
Record the failover process, timestamps, and any manual interventions.

2. Re-enable Replication (If Applicable)
If the primary is restored, reconfigure replication:

Set-VMReplication -VMName <VMName> -PrimaryServer <PrimaryFQDN>

3. Update Backup Policies
Ensure backups are taken post-recovery to maintain a consistent state.


Backup Integration for DR

Hyper-V Replica is not a substitute for backups. Use tools like Windows Server Backup or third-party solutions to:
- Schedule regular backups of VMs.
- Test restore procedures quarterly.
- Store backups offsite for additional redundancy.

Example backup command:

Start-WBBackup -VMName <VMName> -BackupSet <BackupSetName>


Key takeaways

  • Verify replication health and network connectivity before initiating recovery.
  • Use PowerShell cmdlets like Failover-VMReplication and Test-VMReplication for controlled failover and validation.
  • Test backups regularly to ensure they can restore VMs to a consistent state.
  • Document all recovery steps and update DNS/network configurations post-failover.
  • Combine Hyper-V Replica with backups for a layered disaster recovery strategy.