Edit

Share via


Replicate a virtual machine with Hyper-V Replica

Hyper-V Replica helps you protect your workloads by replicating virtual machines (VMs) between Hyper-V hosts running Windows Server. This article explains how to replicate a virtual machine after you enable replication on the receiving host or cluster by using Hyper-V Manager, Failover Cluster Manager, PowerShell, or Windows Admin Center - Virtualization mode.

You can replicate between clusters, single hosts, or a combination of both. If you use a certificate for authentication, there's no Active Directory dependency between the hosts. Single hosts can either be domain members or be in a workgroup.

For more information about Hyper-V Replica and how it works, see Hyper-V Replica overview. If you need to enable Hyper-V Replica, see:

Prerequisites

Before you begin, make sure you meet the following prerequisites:

  • You have a Hyper-V cluster to receive the replicated VM on which you already configured Hyper-V Replica. If you need to configure Hyper-V Replica, see Enable Hyper-V Replica on a failover cluster or Enable Hyper-V Replica on a single host. You also have another cluster or single host that runs the VM you want to replicate.

  • Sufficient network connectivity and bandwidth between primary and replica sites to meet your Recovery Point Objective (RPO) and initial replication method. Consider dedicating or QoS‑throttling replication traffic to avoid impacting production workloads.

  • If you're using certificate-based authentication, you need to have a valid certificate installed on each host in each cluster or single host, both sending and receiving. The certificate must meet the following requirements:

    • Not be expired
    • Have both Client and Server Authentication Enhanced Key Usage (EKU) attributes and an associated private key.
    • Terminate at a valid root certificate.
    • The subject common name (CN) or subject alternative name (SAN) must match the fully qualified domain name (FQDN) of the Hyper-V Replica Broker role you provide for the receiving cluster.
  • Adequate storage capacity on the replica site for the VM, including its configuration files, virtual hard disk (VHDX or VHD) files, and optional extra recovery points (snapshots).

  • A user account that's a member of the Hyper-V Administrators security group on each host. In an Active Directory domain, you can add users or groups to this group by using Group Policy Preferences. Alternatively, the account can be a local administrator on each host. You can find more information about the Hyper-V Administrators group in Active Directory Security Groups.

Replicate a virtual machine

You need to enable replication for each VM you want to replicate. You can replicate a VM using the following combinations:

  • Hyper-V Manager on clusters or single hosts.
  • Failover Cluster Manager on clusters only.
  • PowerShell on clusters or single hosts.
  • Windows Admin Center - Virtualization mode on single hosts only.

Select the relevant tab for instructions.

To replicate a virtual machine by using Hyper-V Manager:

  1. Open Hyper-V Manager on a device you use to manage a host in the primary cluster or a primary single host with the VM, or on the host itself where Windows Server with Desktop Experience is installed.

  2. In the resources pane, select the host that contains the VM you want to replicate.

  3. Right-click the VM you want to replicate, then select Enable Replication. In the Enable Replication screen, if you see Before You Begin, select Next.

  4. For Specify Replica Server, in the Replica Server box, enter either the NetBIOS or FQDN of the Replica server. If the Replica server is part of a failover cluster, enter the name of the Hyper-V Replica Broker. Then select Next. The connection to the replica server is verified to retrieve the authentication and port settings you configured for the replica server.

    A screenshot of the Enable Replication wizard showing the Specify Replica Server page with the Replica Server name field.

  5. Review the replica server settings. If you're using certificate-based authentication, select Select Certificate, then you're prompted to select the certificate for the primary host that matches the requirements. If you want to compress the data that is transmitted over the network, check the box. Select Next.

    A screenshot of the connection parameters page showing authentication method, certificate selection, compression option, and port settings.

  6. For Choose Replication VHDs, make sure the checkboxes for the VHDs you want to replicate are selected, and clear the checkboxes for any VHDs that you want to exclude from replication. Then select Next.

    A screenshot of the Choose Replication VHDs page listing virtual hard disks with checkboxes to include or exclude from replication.

  7. For Configure Replication Frequency, specify how often changes should be synchronized from the primary to replica clusters or hosts from 30 seconds, 5 minutes, or 15 minutes. Then select Next.

    A screenshot of the Configure Replication Frequency page with options for 30 seconds, 5 minutes, or 15 minutes.

  8. For Configure Additional Recovery Points, select Maintain only the latest recovery point or Create additional hourly recovery points and the number of extra recovery points you want to create in hours. Then select Next.

    When you create extra hourly recovery points, you can also check the box Volume Shadow Copy Service (VSS) snapshot frequency if you want recovery points to provide application-consistent recovery points for VMs running VSS-aware applications.

    A screenshot of the Configure Additional Recovery Points page with options for latest point only, hourly points, and VSS snapshot frequency.

  9. For Choose Initial Replication, select the initial replication method. The total size of the initial copy is displayed. Select an option from the following list, then select Next.

    • Send initial copy over the network: this method is the default option.
    • Send initial copy using external media: specify a folder location on local or external media where the initial copy can be stored.
    • Use an existing virtual machine on the Replica server as the initial copy: restore the VM on the replica server and use it as the basis for replication, then replicate only the changes. You can find the process to import the initial copy in the section Send initial copy using external media.

    If you select Send initial copy over the network or Use an existing virtual machine on the Replica server as the initial copy, you can optionally specify whether to start replication immediately, or start replication at a specified time and date up to seven days in the future.

    A screenshot of the Choose Initial Replication page showing network transfer, external media, existing VM options, and scheduling settings.

  10. Review the summary information, then select Finish.

    A screenshot of the summary page listing the selected replication settings before finishing the wizard.

  11. A dialog box appears to indicate that replication was successfully enabled.

    A screenshot showing the Enable Replication success dialog confirming replication is enabled for the virtual machine.

  12. To monitor the initial replication progress, see the section Monitor replication progress. You can change replication settings later if you need to in the Replication section of the VM settings.

    If you chose to send the initial copy by using external media, see the section Send initial copy using external media for the process to import the initial copy. A placeholder VM is created on the replica site and its replication health state is Warning. The replica contents for the VM are stored on your external media in a subfolder for the VM. Once the export is complete, safely eject the external media and transport it to the replica server.

Important

The following behaviors apply to VMs that you replicate:

  • When you replicate a VM, its network adapters aren't connected to a virtual switch on the replica host. After the initial replication is complete, connect any network adapters to a virtual switch on the replica host so that VMs are ready to bring online if you need to fail over.

  • If you make changes to the VM configuration, such as changing memory or processor settings or modifying network adapters, those changes aren't automatically replicated to the replica VM. You must manually update the replica VM if needed. Alternatively, you can remove replication and re-enable it to create a new replica VM with the updated configuration.

  • Hyper-V Replica points to a single default volume for VM replication. To prevent capacity or performance issues, move the VM's storage to a different volume than the default volume for replication.

  • If a VM runs an application that saves data across virtual hard disks, you can ensure that all virtual hard disks selected for replication are replicated to the same point in time. An example of where this approach is useful is when an application has one virtual hard disk dedicated for application data, and another virtual hard disk dedicated for application log files. To use this feature, configure VM replication by using PowerShell with the Enable-VMReplication cmdlet and add the parameter EnableWriteOrderPreservationAcrossDisks. For more information, see Enable-VMReplication.

Send initial copy using external media

If you send the initial copy by using external media, such as a hard disk or USB drive, the process creates a placeholder VM on the replica site with a checkpoint. The process stores the replica contents for the VM on your external media in a subfolder for the VM. You transport the initial copy to the replica server, then import it to the placeholder VM.

You can enable replication by using Hyper-V Manager, Failover Cluster Manager, PowerShell, or Windows Admin Center - Virtualization mode. Select the relevant tab for instructions.

To send the initial copy by using external media and import it by using Hyper-V Manager:

  1. Follow the steps in the section Replicate a virtual machine using Hyper-V Manager. The process creates a placeholder VM on the replica site and sets its replication health state to Warning. The process stores the replica contents for the VM on your external media in a subfolder for the VM. Once the export is complete, safely eject the external media and transport it to the replica server.

  2. Open Hyper-V Manager on a device you use to manage the replica host, or on the replica host itself where Windows Server with Desktop Experience is installed.

  3. In the resources pane, select the host that contains the placeholder VM you're replicating.

  4. Right-click the placeholder VM, then select Import Initial Replica.

  5. Specify the location where the initial copy is stored, then select Complete Initial Replication.

    A screenshot of the Import Initial Replica dialog in Hyper-V Manager showing the path to the exported replica data and the Complete Initial Replication option to finalize applying the offline copy.

  6. The process applies the initial checkpoint to the placeholder VM and changes the replication health state to Normal. Replication continues at the specified frequency. See the section Monitor replication progress to monitor continued replication progress.

Monitor replication progress

You can monitor the progress of the initial replication and ongoing replication by using Hyper-V Manager, Failover Cluster Manager, PowerShell, or Windows Admin Center - Virtualization mode. The replication health states are:

  • Normal: Replication cycles complete on schedule (RPO met), backlog is minimal, and there are no recent replication errors. No action needed.

  • Warning: Replication works but lags or backlog grows (often transient network or storage load). Monitor and investigate if it doesn't clear quickly.

  • Critical: Replication stalls or fails. The RPO is at risk as changes aren't applying. Investigate immediately, such as check connectivity, storage capacity and performance, authentication and certificates, and event logs. Resume or resynchronize as required.

Select the relevant tab for instructions.

To monitor replication progress by using Hyper-V Manager:

  1. Back in Hyper-V Manager, select a host.

  2. In the central pane, add a column for Replication Health to show the high-level health status of replication for each VM. Right-click on any column heading, select Add/Remove Columns. In the list of Available Columns, select Replication Health, then select Add to move it to Displayed Columns. Select OK.

  3. View summary replication information, such as the last synchronized time and primary and replica host FQDNs. Select the VM, then in the bottom pane select the Replication tab.

    A screenshot of Hyper-V Manager with a virtual machine selected and the Replication tab showing summary health status, last synchronized time, and replica server information.

  4. To view more detailed replication information, right-click the VM and select Replication, then View Replication Health. You can reset the replication statistics if needed by selecting Reset Statistics.

    A screenshot of the Replication Health dialog displaying detailed Hyper-V Replica metrics including replication state, health, statistics, and recovery point information for the selected virtual machine in Hyper-V Manager.

Configure extended replication (optional)

You can configure extended replication, which enables you to replicate a VM to a third location, from one replica server to another replica server. This approach can help you meet compliance requirements for offsite backups or provide an extra layer of protection for your workloads.

You can enable extended replication by using Hyper-V Manager, Failover Cluster Manager, or PowerShell. You can't use Windows Admin Center - Virtualization mode to configure extended replication at this time.

Select the relevant tab for instructions.

To configure extended replication by using Hyper-V Manager:

  1. Open Hyper-V Manager on a device you use to manage the host with the VM, or on the host itself where Windows Server with Desktop Experience is installed.

  2. In the resources pane, select the host that contains the VM you want to configure extended replication for.

  3. Right-click the VM you want to configure extended replication for, then select Replication > Extend Replication.

  4. The process to configure extended replication is similar to replicating a VM to the first replica location. Follow the process in the section Replicate a virtual machine with the following exceptions:

    • You can't specify which virtual hard disks to replicate. The virtual hard disks that are replicated to the first replica server are used for extended replication.
    • The replication frequency can only be 5 minutes or 15 minutes.
    • You can't change the authentication type.

Next step

After you enable replication for a VM, you can test failover to the replica server without impacting ongoing replication. For more information about performing a test failover and how to fail over during an outage, see Failover a replicated virtual machine with Hyper-V Replica.