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

4 min read


In Windows Server 2012 R2, the Hyper-V team added the ability to resize virtual hard disks attached to a vSCSI 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 operation for virtual machine <VMName> as virtual size of one ore 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 the size of the disk.


You can also use the Get-VHD PowerShell commandlet.

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

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 above steps using PowerShell. For this reason, I created the following nifty tool to help you can tackle and fix 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      : 1.0
	Date created : 15.August.2016
	Last modified: 18.August.2016
	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:

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

param (
    [Parameter(Position=0,Mandatory=$true,HelpMessage = 'Primary Server')]
	[Parameter(Mandatory=$true,HelpMessage = 'Replica Server')]

    [Parameter(Mandatory=$true,HelpMessage = 'VMName')]

# 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!

[email protected]

About Charbel Nemnom 579 Articles
Charbel Nemnom is a Cloud Architect, Swiss Certified ICT Security Expert, Microsoft Most Valuable Professional (MVP), and Microsoft Certified Trainer (MCT), totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 17 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize the performance of mission-critical enterprise systems. Excellent communicator is adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design, business continuity, and cloud security.

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.