You dont have javascript enabled! Please enable it!

HyperV Replica–Virtual size of one or more virtual hard disks are different between Primary and Replica servers

3 Min. Read


In Windows Server 2012 R2, the Hyper-V team added the ability to resize virtual hard disks attached to a virtual SCSI controller while the virtual machine is running.

For more information about resizing virtual hard disks, see Configure Online Virtual Hard Disk Resize.

With Online Virtual Hard Disk Resize, Hyper-V Replica took the benefit of this feature as well, so you can resize a virtual disk while the VM is running and been enabled for replication. There is no need to resync the VM after modifying the disk, and no need to delete and re-enable the replication!

Fix Error Event 29260, Hyper-V-VMMS

A classic example of this error is shown in the following screenshot, you resize the virtual disks for a VM on the Primary site without resizing the Replica site virtual disks as well.


As you can see, the error message in the event viewer is a bit misleading.

[Cannot perform the operation for virtual machine <VMName> as the virtual size of one or more virtual hard disks are different between primary and Replica servers. Delete and re-enable replication.]

In fact, we don’t need to delete and re-enable the replication as mentioned earlier in order to have the Primary and Replica VM back in Synch. The resync operation will not proceed as the two disks have different sizes.

The workflow to fix this error is the following:

Step 1

On the primary site, select the virtual disk that you resized and use the Inspect option to check the current size of the disk.


You can also use the Get-VHD PowerShell command-let.

Get-VM -VMName <VMName> | Select-Object VMid | Get-VHD | Select-Object @{Expression = { $_.ComputerName}; Label="VMName"}, @{Expression = { ($_.FileSize / 1GB)}; Label="Current Disk Size (GB)"}, @{Expression = { ($_.Size / 1GB)}; Label="Max Disk Size (GB)"}

Step 2

On the replica site, select the corresponding virtual disk and resize it using the Edit disk wizard or the Resize-VHD PowerShell command-let to match the current size at the Primary site.


Step 3

Once you edit the disk at the replica site, you can resume the replication on the VM from the Primary site using Hyper-V Manager or the Resume-VMReplication PowerShell command-let.

Get-VM -VMName <VMName> | Where-Object { $_.ReplicationHealth -eq "Critical" } | Resume-VMReplication -Resynchronize


Step 4

Once the replication is resumed, Event ID 29266 is logged under Hyper-V-VMMS logs as shown in the next screenshot.


Followed by “Resynchronization was successfully initiated for the primary virtual machine”. Event ID 32325.


Ensuring that the Replica disk is resized according to the Primary disk and resuming replication will be sufficient for resynchronization to continue.

Voilà! That’s all there is to it… You can also automate the above steps using PowerShell. For this reason, I created the following nifty tool to help you can tackle and fix the above error instantly.

    Hyper-V Replica Resize tool.

    Hyper-V Replica Virtual Hard Disk Resize tool.

    File Name    : Resize-HVReplica.ps1
    Author       : Charbel Nemnom
    Version      : 2.0
    Date created : 15.August.2016
    Last modified: 04.May.2021
    Requires     : PowerShell Version 4.0 or above
    OS           : Windows Server 2012, 2012 R2 and 2016 Hyper-V
    Module       : Hyper-V-PowerShell

    To provide feedback or for further assistance please visit:
Cover Page
.EXAMPLE .\Resize-HVReplica.ps1 -primaryserver <PrimaryHost> -replicaserver <ReplicaHost> -VM <VMName> This example will get the VM information from the Primary site and Replica site, Then find the right disk, and resize it to match the primary VM virtual disks. #> [CmdletBinding()] param ( [Parameter(Position=0,Mandatory=$true,HelpMessage = 'Primary Server')] [Alias('PrimHV')] [String]$primaryserver, [Parameter(Mandatory=$true,HelpMessage = 'Replica Server')] [Alias('RepHV')] [String]$replicaserver, [Parameter(Mandatory=$true,HelpMessage = 'VMName')] [Alias('VMName')] [String]$VM ) # Get VM info from the Primary and Replica site Write-Verbose "Get VM info from the Primary and Replica site" $HVRinfo = Invoke-Command -ComputerName $primaryserver, $replicaserver -ScriptBlock { Get-VM -VMName $Using:VM | Select-Object VMid | Get-VHD } $priminfo = $HVRinfo | Where-Object {$_.PSComputerName -eq $primaryserver} $replinfo = $HVRinfo | Where-Object {$_.PSComputerName -eq $replicaserver} $CountedVHDs = $priminfo.Count for ($i=0; $i -lt $CountedVHDs ; $i++) { if($priminfo.Size[$i] -ne $replinfo.Size[$i]) { # Find the right disk, and resize it to match the primary site Write-Verbose "Connect to Replica site " Invoke-Command -ComputerName $replicaserver -ScriptBlock { param ($replinfo,$priminfo,$VM) # Resize the disk on the replica site Resize-VHD -Path $replinfo.Path -SizeBytes $priminfo.size } -ArgumentList $replinfo[$i], $priminfo[$i], $VM Write-Verbose "Resize the virtual disk for VM: $VM on $($replinfo.PSComputerName[$i]) host to $($priminfo.size[$i]/1GB)GB." } Write-Verbose "Virtual Disk $($priminfo.Path[$i]) has the same size" }

This tool will help you to get the VM information from the primary and replica site, then find the right disk which is out of Synch and resize it to match the primary VM virtual disk(s).


Hope this post has been useful and thank you for reading!


Photo of author
About the Author
Charbel Nemnom
Charbel Nemnom is a Senior Cloud Architect, Swiss Certified ICT Security Expert, Certified Cloud Security Professional (CCSP), Certified Information Security Manager (CISM), Microsoft Most Valuable Professional (MVP), and Microsoft Certified Trainer (MCT). He has over 20 years of broad IT experience serving on and guiding technical teams to optimize the performance of mission-critical enterprise systems with extensive practical knowledge of complex systems build, network design, business continuity, and cloud security.

Related Posts


Step by Step: Secure and Control a PowerShell Direct Session with Just Enough Administration #HyperV #PowerShell #JEA

New #VMware Migration Offer for #WindowsServer #HyperV


2 thoughts on “HyperV Replica–Virtual size of one or more virtual hard disks are different between Primary and Replica servers”

Leave a comment...

Let me know what you think, or ask a question...

error: Alert: The content of this website is copyrighted from being plagiarized! You can copy from the \'Code Blocks\' in \'Black\' by selecting the Code. Thank You!