locked
Native boot from VHD pagefile issues RRS feed

  • Question

  • I am creating an automatic deployment procedure that does not use MDT, but I figured the experts would be following this forum.  This is a rather long explanation, so be forewarned.

    I am looking for someone with experience in configuring a server to use a native boot VHD.  I am running into a strange issue with pagefile configuration.

    Background: I am using a non-Microsoft PXE boot environment, so I can't use WDS.  But I do use WinPE.  Here is my process:
    1. Customize WinPE's startnet.cmd file to perform the following steps:
    2. Wipe, partition, and format system hard drive.  Formatted as GPT/UEFI disk.
    3. Copy Host.vhdx to the system. (Host.vhdx was created from an install.wim file)
    4. Create boot entry for Host.vhdx by running bcdboot
    5. Copy tailored unattend.xml to Host.vhdx root and SetupComplete.cmd to \Windows\Setup\Scripts.
    Booting from the WinPE image does all this and when WinPE exits, the system properly boots into the operating system on Host.vhdx.  C: refers to Host.vhdx and D: refers to the physical drive on the physical system.  In this particular case, I have a physical drive of about 63 GB and Host.vhdx is 40 GB, leaving about 20 GB of free space on the physical drive.

    What appears to be happening is that when the system first boots after WinPE exits is that the Windows boot process has to first access D: in order to read in Host.vhdx.  It does not find a pagefile.sys, so it creates one on D:  My system has 256 GB of physical memory, so Windows creates a pagefile that takes up almost all available space on the physical drive.  Then the boot process loads Host.vhdx and continues the booting process.  When the system comes up, it complains because of low disk space on D:

    So I figured I would automate the configuration of the pagefile.  I do this from a PowerShell script I call from SetupComplete.cmd.  The first thing it does is it uses Win32_PagefileSystem to set AutomaticManagedPagefile to false.  I then use Win32_PagefileSetting to set the initial/maximum sizes of the pagefile.  When I call Win32_PagefileSetting, it returns just a single object - C:\pagefile.sys.  But if I call Win32_PagefileUsage, it returns a single object - D:\pagefile.sys.  Now, because I have set AutomaticManagedPagefile to false, I end up getting a couple of warnings.  When the system boots, it warns me that it made some adjustments to my pagefile settings.  Basically, what it is telling me is that it is still automatically creating/using the pagefile on D:  And, since the pagefile on D: is still taking up nearly all available space, I still get the low space warning message.

    What I want to be able to do is to either tell the system to stop using D: (don't know if the boot process will honor that) or set the pagefile settings on D: to a custom value for initial/max, just like I am doing on C:\pagefile.sys.  I can easily do this from within the GUI after the system is booted.  I bring up the GUI and because my script ran automatically during deployment it shows that pagefile is not automatically managed, that C:pagefile.sys has the values I set for initial/max, and that D: does not have a pagefile.  Which is interesting, because if I call Win32_PagefileUsage, it clearly shows that it is looking at D:\pagefile.sys.  But, I can then enter initial/max values for D:\pagefile.sys, set, reboot, and everything is fine.  But running the GUI is not acceptable because it is a manual process.

    Does anyone know what I might be able to do here?  Win32_PagefileSetting does not find D:\pagefile.sys, so I can't use that to set the initial/max.  I have tried using Set-WMIInstance on Win32_PagefileSetting to try to add D:\pagefile.sys, but it errors out.  Tried multiple variations on a theme on this and none seem to work.

    The fact that the GUI is able to change it says that the operating system is capable to make the changes.  But the only thing I have found that is capable of making the change - Win32_PagefileSetting - is not finding D:\pagefile.sys.  I am guessing this is because Win32_Pagefile setting is only working on defined pagefiles.  And since D: is set to have none, Win32_PagefileSetting can't be used to set things.  So is there a WMI class that would be used to change D: from none to Custom size?


    . : | : . : | : . tim

    Wednesday, October 14, 2015 7:16 PM

Answers

All replies

  • How about just modifying the pagefile registry key instead of trying to figure out the pagefile WMIs - http://krzywanek.de/tips/nt0117.htm
    • Marked as answer by Tim CerlingMVP Wednesday, October 14, 2015 10:22 PM
    Wednesday, October 14, 2015 7:48 PM
  • You could try using the following WinPE utility:

    wpeutil.exe CreatePageFile [/path=<path>] [/size=<size_in_MB>]

    If you omit /path and /size, I believe it will create the pagefile.sys in c:\ with a default size of 64MB.

    The following example should create a 512MB pagefile.sys in d:\

    Ex: wpeutil.exe CreatePageFile /path=d:\pagefile.sys /size=512

     


    Please remember to: "Vote" if my response was helpful. "Mark As Answered" if I answered your question correctly. V/R, Darrick West - Senior Systems Engineer, ConfigMgr: OSD






    • Proposed as answer by Darrick West Wednesday, October 14, 2015 8:38 PM
    • Edited by Darrick West Wednesday, October 14, 2015 8:54 PM
    • Unproposed as answer by Tim CerlingMVP Wednesday, October 14, 2015 8:56 PM
    Wednesday, October 14, 2015 8:38 PM
  • You could include this in your unattend.xml:

    https://technet.microsoft.com/en-us/library/cc749012(v=ws.10).aspx


    Please remember to: "Vote" if my response was helpful. "Mark As Answered" if I answered your question correctly. V/R, Darrick West - Senior Systems Engineer, ConfigMgr: OSD

    Wednesday, October 14, 2015 9:00 PM
  • Darrick,

    I tried using the wpeutil to create pagefile on the physical disk.  Right now I have my startnet.cmd set up to allow me to manipulate things from the console of WinPE so I can test different things.  That did not fix the issue.  And, the link you provided for creating a pagefile within unattend.xml is for doing it within WinPE.  So it looks like what I do at the WinPE level to create that pagefile is not working to fix the issue.

    MrBrooks,

    I generally try to avoid munging the registry - just have had an aversion to do that from the very beginning.  But, I did that manually and it did fix the issue.  I am going to try putting it into my SetupComplete.cmd scripts and see what happens.


    . : | : . : | : . tim

    Wednesday, October 14, 2015 9:39 PM
  • What was the reported result from running the wpeutil.exe?

    I just tried running it as I described and the pagefile.sys was created in both instances.

    I performed a reboot and a dir /AH pagefile.sys to confirm it was created with the assigned size.


    Please remember to: "Vote" if my response was helpful. "Mark As Answered" if I answered your question correctly. V/R, Darrick West - Senior Systems Engineer, ConfigMgr: OSD

    Wednesday, October 14, 2015 10:10 PM
  • It created the pagefile.sys with no problem. The issue was that it did not change the issue on the boot.  It did not seem to be recognized by the boot process.  I really think it is something strange going on when booting native from VHD.  It is not getting loaded into the registry properly.

    Even though I am not a fan of registry hacking, I tried MrBrooks' suggestion.  I added a few commands to a PowerShell script I execute from SetupComplete.cmd, and it worked fine.  Basically I edited the value of PagingFiles in the registry to add a reference to D:\pagefile with a size of 256-512.  That took care of the issue.


    . : | : . : | : . tim

    Wednesday, October 14, 2015 10:21 PM
  • Ok. Thanks for the detail and I'm glad you found a working solution.

    Please remember to: "Vote" if my response was helpful. "Mark As Answered" if I answered your question correctly. V/R, Darrick West - Senior Systems Engineer, ConfigMgr: OSD

    Wednesday, October 14, 2015 10:25 PM