There are two topics I’m going to explain in this article (1) why you can’t relocate paging file to a Virtual Hard Drive connected to a SCSI Controller in Hyper-V running on Windows Server 2012 and earlier versions and (2) how you can utilize the new booting architecture introduced in Windows Server 2012 R2 to relocate paging file to a SCSI Controller.
Before you start to dig more into this, let me start off by saying that you can’t assign paging file to a Virtual Hard Disk connected to a SCSI controller in Hyper-V unless you are running Windows Server 2012 R2, which is going to be released by the end of the year.
Why you can’t relocate Paging File?
There are several logical reasons as to why you can’t relocate paging file to a SCSI Controller VHD for a virtual machine which is running on Hyper-V Windows Server 2012 and earlier versions. One of the several reasons is that the SCSI controllers are available only when you have installed “Integration Components” in a Virtual Machine. SCSI controllers, as opposed to IDE controllers, do not ship with Hyper-V BIOS. They actually ship with “Integration Components”. “Integration Components” are initialized only after Kernel Mode components have finished its job and paging file initialization takes place as part of the Kernel Mode. I’ll give you a little more detail on that.
Note: Relocating a paging file requires a reboot for changes to take effect. This is because the “Session Manager” (part of Kernel Mode) is responsible for initializing the relocated/new paging file at the time of booting. This cannot happen on the fly and that’s why the OS must be restarted for the changes to take place.
Technically speaking, you can relocate paging file to a VHD file attached to a SCSI controller and also Operating System is not going to stop you from doing this but for whatsoever reason Operating System is not going to use it for sure! You might end up having two paging files if you do so! This is because the way Operating System locates and uses paging file during boot which is explained in the below process.
This is what happens when Operating System starts:
- Windows Boot Manager Starts.
- Emulated IDE driver, which is part of Hyper-V BIOS, is loaded in the memory.
- Kernel Mode gains the control.
- Kernel Mode components are initialized and drivers are loaded in the memory.
- “Session Manager” initializes itself and locates a paging file to be used by querying the following registry entries:
HKLMSYSTEMCurrentControlSetControls”Session Manager”Memory Management.
There are two registry entries checked by the “Session Manager” to determine the current paging file location; PagingFiles and ExistingPageFiles.
6. “Session Manager” looks for the paging file in the above registry entry and initialize it.
7. If the “Session Manager” does not find any paging file at that location, it creates a paging file on the Operating System drive and resets above two registry entry values. It also shows an informational message as shown below:
Note: At this point, SCSI controllers are not loaded. Only the Emulated IDE is available for Operating System use.
8. Once the Kernel Mode components have loaded Operating System successfully, the Hyper-V “Integration Components” are initialized which includes initializing the SCSI Controller driver.
The point here is that the SCSI controller drivers are initialized and loaded only after Kernel Mode components have finished loading Operating System successfully.
How to Relocate Paging File?
Before I start explaining how you do it, let me tell you that Microsoft changed the booting architecture for Virtual Machines running on Windows Server 2012 R2 Hyper-V Server. Starting with Windows Server 2012 R2, there are two types of virtual machines you can create; “Generation 1” and “Generation 2”. “Generation 1” is same as a virtual machine running on Windows Server 2012 Hyper-V and earlier versions.
“Generation 2” Virtual Machine utilizes the new booting architecture which supports booting from a SCSI Controller Virtual Hard Disk. Booting from SCSI VHD is now possible because of a subset of “Integration Components” (including SCSI Controller driver) are loaded at Virtual Machine start-up.
Since the Operating System is able to boot from a SCSI Virtual Hard Drive, it is now possible to assign paging file to a SCSI controller Virtual Hard Disk. This is only possible if you create a virtual machine with “Generation 2” Type but again this is limited to newer guest Operating Systems like Windows 8 and Windows Server 2012.
When you create a Generation 2 virtual machine, all legacy drivers (IDE and Network adapters) are removed and a subset of “Synthetic” drivers are presented to the virtual machine. In earlier versions of Hyper-V, these Synthetic drivers are actually available when you install the Integration Service components. One thing I want to highlight with regards to the Generation 2 technology is that Generation 2 technology was not introduced to address the “paging file relocation problem” but to provide a set of new features which were not possible in Hyper-V running on Windows Server 2012 and earlier versions.
Apart from booting guest Operating System from a Virtual Hard Disk connected to a SCSI Controller, it is now also possible to install the guest Operating Systems from a PXE Server with the help of PXE Client. Moreover, booting and installation of an Operating System are much faster.
As you can see in below screenshot, you are provided with four booting options; booting from a file, booting from a DVD drive, booting from Network Adapter (PXE), and booting from a VHDX file.
Virtual Machine will try to boot from the order you have specified in the “Firmware” settings shown in the above screenshot.
What you see below is the screenshot of newly created “Generation 2” virtual machine on Windows Server 2012 R2. As you can see, there are 64 SCSI channels are made available for Virtual Machine and this is, of course, without installing the “Integration Components”! This is a new virtual machine which has been created using “Generation 2” type and Operating System is yet to be installed.
You also notice that there are no IDE Controllers available in Generation 2 Virtual Machine. “Add Hardware” settings do not show anything about adding IDE Controllers and Legacy Network Adapters as shown in the below screenshot:
Shown in the red square in the above screenshot is the Synthetic drivers. So there are no legacy drivers provided with the “Generation 2” Virtual Machine and performance is better than a Virtual Machine using the IDE controllers.
Since SCSI Controllers are available before the Operating System starts, it is now possible to relocate the paging file to SCSI controller. This functionality enables “Session Manager” to initialize the paging file during boot.
The whole point here is that the “Synthetic” drivers, which includes SCSI Controller driver also, are presented to the Operating System before Kernel Mode component initialization occur which makes it possible to have paging file relocated to a SCSI Controller Virtual Hard Disk.
In this article we saw why it is not possible to relocate a paging file to a virtual hard drive connected to a SCSI Controller in virtual machines running on Windows Server 2012 Hyper-V and earlier versions.
With the help of new booting architecture introduced with Windows Server 2012 R2 which makes it possible to relocate a paging file to a SCSI Controller Virtual Hard Drive and also provide a number of features which were not possible in earlier versions.
Is Your Office 365 Data Secure?
Did you know Microsoft does not back up Office 365 data? Most people assume their emails, contacts and calendar events are saved somewhere but they're not. Secure your Office 365 data today using Altaro Office 365 Backup - the reliable and cost-effective mailbox backup, recovery and backup storage solution for companies and MSPs
Not a DOJO Member yet?
Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!