Hyper-v Server 2012 R2 has added functionality that enables an admin expand the size of a running/online virtual machine disk.In my Hyper-v 2012 R2 environment, I recently resized a clustered virtual machine root volume (vhdx file)via the following steps:
Open Failover Cluster Manager, navigate to the specific VM, right click and select settings, select hard drive and select the Edit button in the Virtual Disk section:
Click next and choose to Expand the disk:
In the next window, enter the new disk size. I decided to increase my disk by 10GB:
:. Unfortunately, this broke the hyper-v replication setup for this virtual machine with the following error event displayed:
"Hyper-V Replica failed to apply the log file onto the VHD for virtual machine 'infra03'. (Virtual machine ID 3675CCB2-3639-4832-9027-0E87BE60141D). An out-of-bounds write was encountered on the Replica virtual machine. The primary server VHD might have been resized. Ensure that the disk sizes of the Primary and Replica virtual machines are the same."
Finish the wizard and login to the VM. Navigate to Disk Management and verify that the disk increase is displayed as unallocated space:
Right-click on the already existing root volume and select Extend Volume:
Continue to finish the wizard.
The primary virtual machine replication throws an error almost immediately as indicated above. The event log error is shown below:
Use the Hyper-v Manager to navigate to the Replica virtual machine, select the Replication command and choose to View Replication Health:
To resolve the problem, navigate to the replica virtual machine, right click on the replica VM and select settings, hard drive, edit and choose expand the replica virtual disk capacity by the same size as the primary: 10GB:
View the Replication health on the Replica machine and select Reset Statistics to clear the errors. On the Primary virtual machine, make sure to Resume Replication. This should resynchronize any changes between both VMs.