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:
- Disable automatic management of the page file.
- Explicitly remove the page file from the target drive.
- 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
- Open System Properties → Advanced system settings → Performance → Settings → Advanced → Virtual memory → Change.
- Clear Automatically manage paging file size for all drives.
- Select the drive that currently has the oversized pagefile.sys.
- Select No paging file and click Set.
- 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.
- 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.
Option 2 – Use WMI (recommended when the UI misbehaves, especially on large volumes)
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:
- Open an elevated Command Prompt.
- Create the page file on the desired drive (replace
Xwith the drive letter):wmic.exe pagefileset creates name="X:\\pagefile.sys" - Set the initial and maximum size (values in MB):
wmic.exe pagefileset where name="X:\\pagefile.sys" set InitialSize=<InitialMB>,MaximumSize=<MaxMB> - If the page file on
C:is no longer needed, remove it:wmic.exe pagefileset where name="C:\\pagefile.sys" delete - 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: