How to Relocate and Resize Pagefile.sys in Windows Server 2008: A SysAdmin’s Guide


2 views

html

Unlike desktop Windows versions, Server 2008 stores virtual memory settings in a less obvious location. Navigate through:

Control Panel → System → Advanced system settings → Advanced tab → Performance Settings → Advanced → Virtual memory

To move pagefile.sys to a different drive (e.g., from C: to D:):

  1. Select the current drive (usually C:)
  2. Choose "No paging file" and click "Set"
  3. Select the target drive (D:)
  4. Choose "System managed size" or set custom values
  5. Click "Set" followed by "OK"

For most servers, use this PowerShell command to determine physical RAM:

Get-WmiObject -Class Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum | % {[math]::Round($_.sum/1GB)}

Recommended sizes:

  • Minimum: 1.5 × physical RAM
  • Maximum: 3 × physical RAM (for memory-intensive applications)

For scripted deployments, use this reg file:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):44,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\
00,65,00,2e,00,73,00,79,00,73,00,20,00,31,00,36,00,30,00,30,00,20,00,36,00,\
34,00,30,00,30,00,00,00,00,00

This example sets pagefile.sys on D: with min 1600MB/max 6400MB.

After reboot, confirm changes with:

wmic pagefile list /format:list

Or check the file location directly:

dir /a:h pagefile.sys /s

Best practices for server environments:

  • Place pagefile on a dedicated physical disk (not OS disk)
  • For SSD storage, monitor write operations
  • Cluster environments require special handling of pagefile.sys

If the system complains about insufficient virtual memory:

eventvwr.msc

Check System logs for Event ID 2001-2006. Common fixes include:

  • Grant SYSTEM account full control to the pagefile directory
  • Ensure adequate disk space (minimum 2GB free)
  • Verify registry permissions at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

In Windows Server 2008, Microsoft moved the virtual memory configuration from the classic Control Panel location to the newer System Properties interface. Here's how to access it:

1. Right-click on 'Computer' and select 'Properties'
2. Click 'Advanced system settings' in the left pane
3. Under the 'Advanced' tab, click 'Settings' in the Performance section
4. Navigate to the 'Advanced' tab in Performance Options
5. Click 'Change' in the Virtual memory section

When relocating pagefile.sys, follow this procedure carefully to avoid system instability:

  1. Select the current system drive (usually C:)
  2. Choose "No paging file" and click "Set"
  3. Reboot the server (this step is often overlooked but critical)
  4. Return to the Virtual Memory settings after reboot
  5. Select your target drive and configure the new pagefile

The recommended approach for pagefile sizing depends on your server's workload:

Server Type Recommended Size
General Purpose 1.5 × Physical RAM
SQL Server Equal to Physical RAM
Terminal Server 2 × Physical RAM

For administrators managing multiple servers, here's a PowerShell script to modify pagefile settings:

$computer = $env:COMPUTERNAME
$pagefile = Get-WmiObject -Class Win32_PageFileSetting -ComputerName $computer

# Set new pagefile location and size
$newPagefile = $pagefile | Set-WmiInstance -Arguments @{
    Name = "D:\\pagefile.sys";
    InitialSize = 4096;
    MaximumSize = 8192
}

if ($newPagefile) {
    Write-Host "Pagefile configuration updated successfully"
    Write-Host "A system restart is required for changes to take effect"
}

If you encounter problems after modifying the pagefile:

  • Error: "Not enough space to create pagefile"
    Solution: Clean up disk space or choose a different volume
  • Error: System hangs during boot
    Solution: Boot into Safe Mode and revert changes

Use these Performance Monitor counters to validate your changes:

# Memory\\Pages/sec
# Memory\\Page Reads/sec
# Paging File\\% Usage

Run this command to launch Performance Monitor with the relevant counters:

perfmon.exe /sys