A: Hyper-V Replica works by replicating write operations that are stored in transaction log files every five minutes to the replica server. An expand or compact action on a virtual hard disk (VHD) isn't a write operation and therefore doesn't replicate and will break the replication of the VHD.

The only solution is to stop replication, then restart replication. In most organizations, compacting and expanding WHDs isn't a common operation, especially if dynamic VHDs are used; however, it's important to understand that if using Hyper-V Replica for a VM, any compact or expand operations will break the replication.

Below are some steps to "ease the pain":

If Recovery History is off, which means when setting up Hyper-V Replica you did not enable the option to keep additional point in time replica snapshots, do the following:

  1. On the same VHD on recovery, do same operation to get the identical geometry.
  2. Now do Resynchronization of the replica.
  3. Replication should now work again (no Remove Replication is needed in this case).

If Recovery History is on, do the following:

  1. Remove Replication on Primary.
  2. Remove Replication on Recovery as well to let the merge happen for the snapshots.
  3. On the same VHD on recovery, do same operation to get the identical geometry.
  4. Re-setup Replication – use “Smart IR” (“Backup based IR”) – this will do an efficient synchronization of the VHDs and avoid copying over all the content again.

The process above (the Recovery History on scenario) would also be used to add a new VHD to a VM that needs to be replicated:

  1. Copy over the VHD to the replica host and add it to the replica VM on correct IDE/SCSI Controller.
  2. Remove Replication on both sides.
  3. Re-setup Replication and do Smart IR (“Backup based IR”) – this will do an efficient synchronization of the VHDs.