A) Introduce
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
First, you need to learn what Paging File is and they are explained in detail in this article: Link
In Hyper-V, virtual machines (Virtual Machines) with Windows operating system will also create these Page Files. They often have a 1:1 ratio to RAM, which is unnecessary and wastes the VHD space of the virtual machine. Because the virtual machines have been provided by Hyper-V with a sufficient amount of RAM to serve, depending on the needs that the administrator configures.
As I explained about Hyper-V Replica in the previous post, I mentioned Replication Tracker (RT). RT is responsible for tracking changes to the VHD of the virtual machine, so that they know and perform the replication through the Replica Site. However, there are a few files you won’t want to replicate to, commonly seen here is the Paging File (C:pagefile.sys). They are not needed for replication and are often very large files, removing them from the replication process will reduce VHD capacity and reduce WAN/LAN bandwidth for replication.
Here I will guide you to configure and setup Page File to be stored in another VHD, and perform Replication to Replica Site only the required VHD drives (System, Database).
B) Lab “Optimize Hyper-V Replica with excluding paging file”
You should preview the labs on “Hyper-V Replica in Windows Server 2012/2012 R2“
Model :
- Hyper-V1 machine (172.1.1.2/24) : Primary Site
- Hyper-V2 machine (172.1.1.3/24) : is Replica Site
- Domain Controller (File Server): contains virtual machine VM1 (VHD Virtual Machine) and creates a VHD containing Paging File.
- Create a virtual machine on Hyper-V1, but the virtual machine’s Storage will be stored in File Server
- On File-Server, create a folder “Windows 8.1” and Properties -> Share full permissions for 2 physical machines “Hyper-V1 – Hyper-V2”
- Next go to Hyper-V1, proceed to create a new virtual machine
- Save the virtual machine configuration file in the folder just created on File-Server
- Set RAM for virtual machine
- Set up the network for the virtual machine
- Save the VHD (Storage) file of the virtual machine to the folder you just created
- Specify the Windows installation .ISO file
2. Proceed to create VHD Paging File on File-Server and attach them to the virtual machine
- Go to the virtual machine –> “Windows + I” to open the Charm bar –> “PC Info” –> Select “Advanced System Settings -> Advanced -> Settings in Performance” -> Select “Advanced -> Change” we will see Paging The file is located on drive C.
- Go to File-Server -> Go to Run -> Diskmgmt.msc
- Select Action -> Create VHD
- Click Browse and select the folder path just created in step 1 -> Name it VHDX as Paging File
- After creating it -> Right-click on the newly created VHD Disk, select “Initialize Disk” to activate using Disk
- Proceed to create a Volume for this Disk
- Name the Volume and proceed to Format
- After the format is complete -> Proceed to Detach VHD, because VHD is being used in File-Server, we need Detach to serve the virtual machine
- Turn off the virtual machine, right-click Settings
- Select Hard Drive –> click Add to create a new SCSI Controller Hard Drive
- Select to the newly created VHD Paging File in the folder
- Click OK, then Start the virtual machine and go inside to check if the VHD Paging File is displayed
- Proceed to configure Paging File: Go to the virtual machine –> “Windows + I” to open the Charm bar –> “PC Info” –> Select “Advanced System Settings -> Advanced -> Settings in Performance” -> Next select “Advanced – > Change”, uncheck “Automatically manage paging file” and then select drive D to store Paging file -> Stick select System Managed Size.
- The system will ask to reboot to complete the configuration process, message OK and reboot.
3. Proceed to configure Replication and check the Replication process
- Right-click on the virtual machine -> Select “Enable Replication…”
- Select Replica Server (Hyper-V2)
- Use HTTP to communicate + compress data before transmission
- This step is important, we select the VHD Virtual Machine file, do not select Paging File (they will not replicate the VHD Paging File)
- Configure default replication time (5 minutes)
- Configuring Recovery Points
- Configuration allows instant replication
- After Replication -> Right-click the virtual machine -> Replication -> View Replication Health, to check whether the virtual machine has replicated successfully or not
- Now we go to Hyper-V2 side virtual machine storage path and see that only VHD Virtual Machine is replicated (no VHD Paging File) -> Lab successful.