Edit

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 Windows Admin Center - Virtualization mode, Hyper-V Manager, Failover Cluster Manager, or PowerShell.

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 by 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 clusters or single hosts.

Select the relevant tab for instructions.

Important

Configuring Hyper-V Replica by using Windows Admin Center - Virtualization mode is currently in PREVIEW. This information relates to a prerelease product that may be substantially modified before it's released. Microsoft makes no warranties, expressed or implied, with respect to the information provided here.

For more information about Windows Admin Center - Virtualization mode, see Windows Admin Center - Virtualization mode overview.

To enable and configure Hyper-V Replica by using Windows Admin Center - Virtualization mode:

  1. Go to your URL for Windows Admin Center - Virtualization mode and sign in.

  2. In the resources pane, expand the host that contains the VM you want to replicate, and then select the VM to enter its overview.

  3. On the menu bar, select Manage, and then select Configure Replication to open the Enable Replication pane.

    Screenshot of Windows Admin Center - Virtualization mode showing the Manage menu expanded with Configure Replication selected.

  4. For the Replication Connection tab, enter the following information, and then select Replication Configuration to continue:

    1. For Replica Server, enter either the NetBIOS or FQDN of the Hyper-V host you're replicating to.

    2. For Replica server port, enter the port number you configured on the replica host for Hyper-V Replica.

    3. For Authentication Type, select the correct value from Use Kerberos authentication (HTTP) or Use Certificate-based authentication (HTTPS) based on the authentication method you configured on the replica host. If you're using certificate-based authentication, select Select Certificate, and then 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.

    Screenshot of the Replication Connection tab in Windows Admin Center showing replica server, port, authentication, and compression options.

  5. For the Replication Configuration tab, complete the following information, then select Initial Replication to continue:

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

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

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

    Screenshot of the Replication Configuration tab showing virtual hard disk selection, replication frequency, and recovery point settings.

  6. For the Initial Replication tab, complete the following information, then select Review to continue:

    For Configure initial replication, select the initial replication method. The total size of the initial copy is displayed. Select an option from the following list:

    • Send initial copy over the network: this method is the default option. 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.
    • Send initial copy using external media: specify a folder location on local or external media where the initial copy can be stored. To learn about the process to import the initial copy, see Send initial copy using external media.

    Screenshot of the Initial Replication tab showing method choices for network transfer or external media and scheduling settings.

  7. Review the summary information, and then select Enable Replication.

    Screenshot of the Review tab summarizing the chosen Hyper-V Replica settings before enabling replication.

  8. You can check that replication enabled successfully in the Notifications pane.

    Screenshot of the Notifications pane confirming that Hyper-V VM replication was enabled successfully.

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

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 by 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 Windows Admin Center - Virtualization mode:

  1. Follow the steps in the section Replicate a virtual machine by using Windows Admin Center - Virtualization mode. The process creates a placeholder VM on the replica site and sets its replication state to Initial replication in progress. The process stores the replica contents for the VM on your external media in a subfolder for the VM. Safely eject the external media and transport it to the replica server.

  2. In Windows Admin Center - Virtualization mode, from the left pane, select the host to which you're replicating the VM.

  3. From the list of tools for the host, select Virtual machines, and then select the placeholder VM to enter its overview.

  4. In the Replication section, select Import Initial Replica.

    Screenshot of the placeholder VM Replication section in Windows Admin Center with the Import Initial Replica action highlighted.

  5. In the pane that opens, enter the file path to the location where the initial copy is stored. You can also select Browse to go to the location. Select Complete Initial Replication.

    Screenshot of the Import Initial Replica pane showing the file path field and Complete Initial Replication button.

  6. The process applies the initial checkpoint to the placeholder VM and changes the replication health state to Ok. Replication continues at the specified frequency. To monitor continued replication progress, see the section Monitor 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 Windows Admin Center - Virtualization mode:

  1. In Windows Admin Center - Virtualization mode, from the left pane, expand the host that contains the VM you're replicating, and then select the VM to enter its overview.

  2. In the Replication section, view summary replication information, such as the replication health, last synchronized time, and primary and replica host FQDNs.

    Screenshot of the VM overview Replication section in Windows Admin Center showing replication health, sync time, and server details.

Configure static IP injection for failover (optional)

You can configure static IP injection to control the IP address a VM uses when it starts after a failover. If you want the VM to use a dynamically assigned IP address, you don't need to configure these settings. Regardless of the failover type, ensure that you set these values on both the primary server and replica server. The affected VM and the server it runs on must use the same version of integration services.

Static IP injection supports both IPv4 and IPv6 addresses. You configure static IP injection on the replica VM after replication is enabled. The settings are stored in the VM configuration and applied during failover by the Key Value Pair (KVP) Exchange integration component running in the guest operating system.

Note

Static IP injection requires:

  • The latest version of integration services installed in the guest VM.
  • Synthetic network adapters (not legacy network adapters).
  • A supported Windows guest operating system.

Select the relevant tab for instructions.

To configure static IP injection by using Windows Admin Center - Virtualization mode:

  1. Go to your URL for Windows Admin Center - Virtualization mode and sign in.

  2. In the resources pane, expand the host that contains the replica VM, and then select the VM to enter its overview.

  3. From the list of tools for the VM, select Settings.

  4. In the Settings pane, under the VM settings, select Replication.

  5. Select the Networking tab.

  6. To configure IPv4 settings, on the IPv4 TCP/IP Settings sub-tab:

    1. Select the check box for Use the following IPv4 address scheme for the virtual machine.

    2. Enter the IPv4 Address, Subnet Mask, Default Gateway, Preferred DNS Server, and optionally an Alternate DNS Server.

  7. To configure IPv6 settings, select the IPv6 TCP/IP Settings sub-tab and enter the corresponding IPv6 address information.

  8. Select Save replication settings to apply the changes.

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 Windows Admin Center - Virtualization mode, Hyper-V Manager, Failover Cluster Manager, or PowerShell.

Select the relevant tab for instructions.

To configure extended replication by using Windows Admin Center - Virtualization mode:

  1. Go to your URL for Windows Admin Center - Virtualization mode and sign in.

  2. In the resources pane, expand the host that contains the virtual machine you want to configure extended replication for, and then select the virtual machine to enter its overview.

  3. Scroll to the Replication section, select Extend Replication to open the Extended Replication configuration.

  4. For the Replication Connection tab, enter the following information, and then select Replication Configuration to continue:

    1. For Replica server, enter either the NetBIOS or FQDN of the Hyper-V host or cluster you're extending replication to.

    2. For Replica server port, enter the port number you configured on the extended replica host for Hyper-V Replica.

    3. For Authentication type, select the correct value from Use Kerberos authentication (HTTP) or Use Certificate-based authentication (HTTPS) based on the authentication method you configured on the extended replica host. If you're using certificate-based authentication, select Select to choose the certificate. If you want to compress the data that is transmitted over the network, check the box.

  5. For the Replication Configuration tab, complete the following information, then select Initial Replication to continue:

    1. For Configure replication frequency, select 5 minutes or 15 minutes. Extended replication doesn't support a 30-second frequency.

    2. For Configure additional recovery points, select Maintain only the latest recovery point or Create additional hourly recovery points.

  6. For the Initial Replication tab, select the initial replication method, and then select Review to continue.

  7. Review the summary information, and then select Enable Replication.

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.