SQLServerCentral Article

Can you set a pagefile more than 4GB?

,

Introduction

Once upon a time, a Windows 2003 server in my company crashed. I had no idea why it crashed, so I called Microsoft PSS for assistance. The PSS engineer replied that he required a complete memory dump for a root cause analysis. Although, the server was set to perform a complete memory dump, it still did not have enough information for the PSS engineer.

Why? It is because the server has 8GB RAM, but the pagefile size is set for 4095MB, 4GB. It is not large enough to hold all the physical RAM. So I tried to alter the pagefile to make it large enough.

From Microsoft, http://support.microsoft.com/kb/254649, I found this:
If you select the Complete memory dump option, you must have a paging file on the boot volume that is sufficient to hold all the physical RAM plus 1 megabyte (MB).

OK, this means I need to set the pagefile to 8193MB (8 X 1024 + 1) for dumping a "complete memory dump". So I change my pagefile using the following steps.

Steps to set virtual memory in GUI

  1. Right Click "My computer".
  2. Select Properties.
  3. Select Advanced.
  4. Select "Performance Settings".
  5. Select Advanced.
  6. Select Change.
  7. Select "C:".
  8. Select "Custom Size".
  9. Enter 8193 for "Initial size (MB)".
  10. Enter 8193 for "Maximum size (MB)".
  11. Click Set.

The following message appeared.

"Enter a maximum page file size that is greater than or equal to the initial page file size, and less than 4096".

Oops. Does this mean a server with more than 4095MB cannot perform a complete memory dump? It is common that we have servers with more than 4GB RAM. And we can't troubleshoot the crashed machine without complete memory dump?

How to set a pagefile more than 4GB?

I called the Microsoft PSS engineer again, and he sent me the following web link immediately..

http://support.microsoft.com/kb/237740

The virtual memory settings are stored at the following registry value:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\MemoryManagement\Pagingfiles

I entered the value "C:\pagefile.sys 8193 8193". This means to set a pagefile in the path C:\, with a file named "pagefile.sys", an initial size of 8193 (the first value), and a maximum size of 8193 (the second value). You can add more pagefiles on the same drive, or different drives, in this registry value. An example is

C:\pagefile.sys 100 8193
C:\pagefile2.sys 200 8193
D:\pagefile.sys 200 4096

After the registry value has been updated, in the GUI you are now able to alter a pagefile with a size of more than 4095MB. With this trick, my Windows Server 2003 machine has been set for a real full memory dump. When it crashes again, the full memory dump is able to complete.

Can I Set the Pagefile Remotely?

Other than setting the virtual memory values using regedit manually, you can do it with a WMIC command. You do need local administrators rights to run WMIC. Here is the command:

wmic pagefileset where name="C:\\PAGEFILES.SYS" set InitialSize=4096,MaximumSize=4096

To set for a remote machine(s), you can add the parameter "/node:". For multiple machines, use the names separated by commas, without space. Again, you need local administrators rights on the remote machines.

wmic /node:machine1,machine2 pagefileset where name="C:\\PAGEFILES.SYS" set InitialSize=4096,MaximumSize=4096

I have written a batch file to set the virtual memory for all my new machine(s) properly.

@echo off
set /p sn=Please enter computer name(s), separated by comma, no space, e.g. serverA,ServerB:
set /p pf=Please enter pagefile path and name , e.g. C:\\pagefile.sys:
set /p ps=Please enter size (MB), e.g. 4095:
wmic /node:%sn% pagefileset where name="%pf%" set InitialSize=%ps%,MaximumSize=%ps%
echo Please restart your computer(s) to take effective.
cmd /k

Conclusion

Please check your servers, especially the critical servers, to ensure the pagefile is properly set for a complete memory dump in case your server crashes. One of the ways for collecting this information is shown in my previous article. The value should be the total physical RAM + 1MB. Just to be safe, I set mine to the RAM + 200MB.

Reference

http://support.microsoft.com/kb/254649

Rate

3.87 (31)

You rated this post out of 5. Change rating

Share

Share

Rate

3.87 (31)

You rated this post out of 5. Change rating