Excluding Paging File from Hyper-V Replication

Table of contents

Hyper-V Replica is a new feature introduced in Windows Server 2012. It is a disaster recovery solution designed for small and medium sized businesses. Using Hyper-V Replica, the virtualized workloads can be replicated from the Production to disaster recovery site. In case of any disaster, the virtualized workloads can be brought online at Replica Server which is running in a disaster recovery site. In Windows Server 2012 R2, Microsoft enhanced Hyper-V Replica feature to replicate virtualized workloads to a second disaster recovery site but I’m not going to talk about this here.

I would recommend you reading a series of articles on Hyper-V Replica I wrote here:

Replication Tracker (RT), a component of a Replication Engine, tracks changes to the virtual machine’s VHD files and replicate the changed contents to the Replica Virtual Machine running on the Replica Server. Not all the data on a virtual machine you would want to replicate but you would always want to see important data being replicated.

For example, you would always like to replicate the contents of a VHD file where the database files reside. Similarly, you must replicate VHD file where Operating System files reside and any changed content, as part of the virtual machine patching, must also be replicated. There are a few files which you never want to replicate. For example, replicating a paging file to the Replica Virtual Machine makes no sense. The paging file is huge in size and will eat up more bandwidth over a slow WAN if selected for replication. This is also a burden for Replication Tracker (RT) to replicate the paging file contents every 5 minutes.

I wrote an article if you want to understand how Hyper-V Replica components work together to implement the replication technology in Hyper-V.

Note: By default, changed contents in Hyper-V Replica are replicated every 5 minutes and this interval is not configurable.

As part of the best practice items, you must exclude Operating System paging file from Hyper-V Replication. To do so, you must relocate paging file on a separate VHD file which is explained in below steps:

1. Shut down the virtual machine for which you want to enable the replication.

2. Right Click on the virtual machine and open Settings Page.

3. Create a new VHD file and attach it to an IDE controller.

Note: Please make sure to attach new VHD to an IDE Controller. Relocating the paging file to a VHD connected SCSI controller is not supported.

4. Restart the virtual machine, let the Operating System initialize the new VHD, format it and assign a drive letter.

5. Go to System’s property and relocate the paging file to new VHD drive.

6. By doing Right Click on the virtual machine, enable Hyper-V replication for the virtual machine.

7. Select all the VHD files including the VHD file where the paging file resides.

8. Finish and let Hyper-V do the initial replication for the virtual machine.

Note: During the initial replication, the Hyper-V will replicate the contents of VHD files (including the paging file VHD) to the Replica Virtual Machine.

9. Once the initial replication is over, break the replication for virtual machine by selecting “Remove Replication” from the Right Click context menu of the virtual machine as shown in the below screenshot:

10. Once replication is removed for the virtual machine, Right Click on Virtual Machine to re-enable the replication as shown in the below screenshot:

11. At the “VHD File Selection” configuration page, “do not” select the VHD file where the paging file resides.

12. Click on “Finish” button in the wizard for Hyper-V to finish enabling the replication for this virtual machine.

From this point onward, since paging file VHD is excluded from the replication, Replication Tracker (RT) is not going to track changes to the paging VHD file.


Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

25 thoughts on "Excluding Paging File from Hyper-V Replication"

  • Mark Stringer says:

    Hi Nirmal,
    Thanks for the great HyperV articles. If I already have my replication running with the page file on the C drive can I add the extra drive, set it up as E or whatever and then use Windows to move the page file to the new drive? I realise this might cause a large replication transfer depending on the page file size. This way my original replication of the C drive will ignore the new E drive anyway.

    • Nirmal Sharma says:

      Hi Mark, Thanks for reading articles!

      We must break and re-enable replication to include the new VHD file. AFAIK, Hyper-V Replica does not recognize new VHD files on fly! You must re-enable replication and then select the VHD file you want to replication.

      I need to check if the Re-synchronization process actually detects new VHD file while the replication is enabled. I doubt but let me check.


      • Nirmal Sharma says:

        I checked – even the re-synchronization process does not detect any VHD files. We must break the replication to include the new VHD file.


  • John Groset says:

    Now if only Altaro Hyper-V Backup could do the same it would be great. I hate to think of all the space, time, and bandwidth (if doing off-site backup mirroring) that I am wasting by backing up the Paging File VHDx. Being able to exclude VHD’s from a backup is tops on my priority list.

  • Andrew Hunter says:

    What are the implications for the replica VM in a DR scenario? Surely its going to be incredibly slow starting up until you can dive in add a new drive and setup the paging file on it again? Not ideal unless you have a small amount of VM’s you are replicating. Not sure I would consider this to be a best practise. Best practise would be to replicate the paging file until Microsoft add a feature in Hyper-v replica that is smart enough to recognise a page file and then just create a dummy page file on the replica without replicating anything to it.

  • seguier says:

    When you say that we have to create a new VHD file and attach it to an IDE controller. Wich IDE controller should I use ? IDE 0, IDE 1 or it doesn’t matter ?


  • Nirmal Sharma says:

    Hi Seguier,

    You can use any available IDE controller to attach VHD File.


  • Nirmal Sharma says:

    Hi Andrew,

    I’m checking to see how a VHD file can be injected on fly and without breaking the replication.

    Looks like there is a way to attach a VHD file without breaking replication.

    Will keep you posted!

    Thanks for the feedback!

  • Peter Covach says:

    I was working with a Hyper-V 2012 R2 Host with a Windows Server 2008 R2 guest and attempted the above procedure. I was doing everything prescribed, but was receiving the error, “Windows created a temporary paging file…”. I had the disk attached to the IDE controller. I thought at first it was due to using a VHDX drive. So I switched to a VHD. No dice. I thought it was being picky about what IDE controller I was attaching the VHD to. That wasn’t it either. …the cause. I assigned the new dedicated page file VHD to drive letter ‘B:’. It seems that windows doesn’t like that. I then moved it to ‘R:’ and all was fine. I’m assuming I’d have the same problem with drive ‘A:’.

  • Hair Rau says:

    Hi Nirmal,

    Thanks for the great Hyper-V articles. In regards to the excluding paging file from Hyper-V replication, is it true that it does not apply with W2012/W2012R2 hosts as the new OS can do a good job to avoid it?


  • Eric Brody says:

    “Note: Please make sure to attach new VHD to an IDE Controller. Relocating the paging file to a VHD connected SCSI controller is not supported.”

    That’s odd. Why you can’t connect to SCSI controller? I don’t have IDE drive.

  • Nirmal Sharma says:

    Hi Peter,

    This is because A and B drive letters are reserved by Operating System.

    Thanks for reading the articles!

  • Buddhika says:

    Hi Nirmal,

    I have two VMS ; VHDXs belong to those VMs are saved in 2 different disks (VM1; RD server saved on D: which is a SAS drive and vm2, SQL server and application is saved on F: which is an SSD.) I have the exact same physical server to do Hyper-v replication. My problem is in Hyper-v replication, I only can save in one location of the replica server. but I need tO have 2 vms replicated to D: and E: of the replica server. How can I achieve this?


  • Drew Griffin says:

    I would add a small note to step 9. You must Remove Replication from both the Host and Replica servers. I removed it from the host only then spent a good deal of time trying to figure out why the re-enable was failing.

  • Rohan Sawant says:

    I have host in which OS is from SSD data store and Data file is on SCSI data store both are shared drives. we also have Hyper-v replication configured like our primary hyper-v server which has ssd and scsi.
    Problem is when we replicate host machine it stores both OS and Data disk on one drive only, whereas we want to replicate OS on SSD drive and Data on SCSI drive after replication.Is there any setting available.
    Please reply

    • Zoran says:

      Hi Rohan,
      This is possible through a workaround which involves using a storage migration. Here’s a summary of the steps:
      1) Configure Hyper-V Replica and replicate to “Storage 1”. Do not start the replication yet. The configuration files will be copied, but the (large) data file will not be copied.
      2) Through Hyper-V Manager, run a storage migration of the configuration files from “Storage 1” to “Storage 2”
      3) Now the drive with the OS will be replicated to “Storage 2” and the data drive to “Storage 1”

      Symon Perriman
      Altaro Editor

  • Drew Griffin says:

    Thanks for the steps Nirmal. Two questions. In step 9 are you removing replication on the primary or replica server? Also I have concerns about Andrew Hunters comments on spinning up the DR VM. Would you explain what happens when you test failover or actually failover to the replica that is no longer getting the page file pushed on a separate drive? Does the OS just generate page files on the OS C: drive automatically? Appreciate your time,

    • Zoran says:

      Hi Drew,
      – In step 9, you do this on the primary (source) server.
      – Regarding the DR VM, when a recovery is needed, it will take some time to start the VM and load the memory to the most recent state. When you replicate a VM, the Hyper-V configuration file is also copied, which defines the settings for the new VM. The VM will create the page file when it is started on the new hardware. The page file is not supported for replication because it represents the memory on one particular server, so copying it to a different server (even with identical hardware) will likely not function correctly.

      Symon Perriman
      Altaro Editor

Leave a comment or ask a question

Your email address will not be published. Required fields are marked *

Your email address will not be published. Required fields are marked *

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.