Solution - pagefile.sys won't shrink to custom Maximum size set in Performance Options, even after multiple restarts — registry shows correct setting but on-disk file doesn't match

Cal Dornbush 5 Reputation points
2026-06-21T21:07:41.03+00:00

Symptom: An existing, large pagefile.sys (e.g., grown to 9-12 GB under "System managed") doesn't shrink to a smaller custom size after changing it via Control Panel/Settings → Advanced system settings → Performance → Advanced → Virtual Memory → Change, even across multiple full restarts.

Confirm you're hitting this bug:

dir C:\pagefile.sys /a

Compare the actual byte size against your configured Maximum. Also check what Windows thinks is configured vs. active:

Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name PagingFiles, ExistingPageFiles

If PagingFiles correctly shows your new custom size, but the actual file on disk (from the dir command) is still the old size, you're hitting this issue — Windows is failing to perform an in-place resize, silently.

Fix — force delete-and-recreate instead of resize:

In the Virtual Memory dialog, with the affected drive selected:

  1. Select "No paging file" → click Set
  2. Immediately select "Custom size", re-enter your desired Initial/Maximum values → click Set again
  3. Click OK through all dialogs
  4. Restart

Queuing both the removal and recreation in the same session, before any restart, forces Windows to actually delete the old file and build a correctly-sized new one — rather than attempting (and silently failing) an in-place resize.

Verify after restart:

dir C:\pagefile.sys /a

Windows for home | Windows 11 | Performance and system failures
0 comments No comments

1 answer

Sort by: Newest
  1. AI answer

    2026-06-21T21:07:57.82+00:00

    The described behavior is consistent with known issues where the Virtual Memory UI and the paging subsystem do not correctly apply page file size changes, especially when:

    • The page file is on a large partition (for example, larger than 2 TB), where the Virtual Memory UI miscalculates maximum space and fails operations.
    • The system is relying on automatic management and then is switched to a custom size, which can interact poorly with how Windows grows/shrinks the page file.

    The core of the workaround is to avoid relying on the Virtual Memory UI to perform an in-place resize and instead force Windows to delete and recreate the pagefile.sys.

    A reliable approach, aligned with documented guidance, is:

    1. Disable automatic management of the page file.
    2. Explicitly remove the page file from the target drive.
    3. Recreate the page file with the desired custom size.

    There are two supported ways to do this.

    Option 1 – Use the Virtual Memory UI to force delete-and-recreate

    1. Open System PropertiesAdvanced system settingsPerformanceSettingsAdvancedVirtual memoryChange.
    2. Clear Automatically manage paging file size for all drives.
    3. Select the drive that currently has the oversized pagefile.sys.
    4. Select No paging file and click Set.
    5. In the same dialog, still in the same session (before restarting), select Custom size, enter the desired Initial size and Maximum size, and click Set again.
    6. Click OK through all dialogs and restart the system.

    This sequence queues both deletion and recreation, which forces Windows to create a new pagefile.sys at the configured size rather than attempting a resize of the existing file.

    When the Virtual Memory UI miscalculates or refuses the requested size (for example, on partitions larger than 2 TB), use WMI to create and size the page file directly:

    1. Open an elevated Command Prompt.
    2. Create the page file on the desired drive (replace X with the drive letter):
         wmic.exe pagefileset creates name="X:\\pagefile.sys"
      
    3. Set the initial and maximum size (values in MB):
         wmic.exe pagefileset where name="X:\\pagefile.sys" set InitialSize=<InitialMB>,MaximumSize=<MaxMB>
      
    4. If the page file on C: is no longer needed, remove it:
         wmic.exe pagefileset where name="C:\\pagefile.sys" delete
      
    5. Restart the system.

    This bypasses the Virtual Memory UI’s incorrect calculations and directly configures the page file.

    Sizing guidance

    If there is no specific requirement, a common starting point is to set the page file to about 1.5 times the installed RAM. On systems with ample RAM and light paging, a smaller page file may be acceptable; on heavily loaded systems or where memory dumps are required, a larger page file may be appropriate.

    After applying either method, verify the actual size on disk with:

    dir C:\pagefile.sys /a
    

    and confirm it matches the configured values.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.