Page File and Swap File explained. How to delete Pagefile.sys and Swapfile.sys in Windows 8 or 10.

Page File and Swap File explained. How to delete Pagefile.sys and Swapfile.sys in Windows 8 or 10.

by Pete Daniel on 14 November 2014 · 23326 views

The Windows operating system uses a page file to store critical Windows elements that it needs fast access to. When the hibernation option has been enabled then roughly 25 percent of the RAM memory is stored in the page file and 75 percent is stored in the hibernation file.

When the fast boot option has not been enabled which would turn on the hibernation feature then the page file becomes larger in order to store more data. The size of the pagefile.sys file therefore is partly dependent on whether the fast boot option has been enabled within Windows 8/8.1 or 10.

The page file was not always present in older versions of Windows, but it is back in Windows 8/8.1/10.

pagefile.sys and swapfile.sys in win 8.1 File Explorer

What is the Swap File

The Windows swap file which is stored as swapfile.sys usually in the root directory is a type of virtual memory. It is used when the installed RAM memory is deemed by Windows to be insufficient to run its internal operations. In Windows 8/8.1 and 10 it is also used for other purposes as well.

RAM memory is extremely fast for a computer to access but disk access via a solid state drive or a traditional hard drive is considerably slower by comparison. As such, the repeated use of large swap files is an indication that the computer system would benefit greatly from a larger amount of installed RAM because the memory is acting as a bottleneck and slowing down system performance.

The swap file is not used during a fast bootup process with Windows 8/8.1/10. Only the hiberfil.sys hibernation file is activated for alternative boot paths like the hybrid booting process which speeds up the boot time.

Why Is The Swap File Present?

Beyond the need for greater virtual memory to compensate for limited installed RAM, the swap file is also used in Windows 8/8.1/10 to help when suspending and resuming Metro apps. These were first introduced in Windows 8. They would not work well using the page file construct because the page file is designed to speed up other types of paging activities within the Windows operating system.

How The Page File & Swap File Work In Harmony Together

Whereas the page file can hold items that a user or the system has not accessed in some time, the swap file holds items that were accessed very recently and may need to accessed again very soon. Therefore there is some degree of differentiation between the roles of the swap file and the page file along with the data each contains.

The page file becomes more effective with higher specification machines that can really benefit from the way Windows manages the paging process. In the case of the swap file, this benefits lower powered PCs and Windows tablets which need access to more information because usually the installed RAM memory is more limited.

Both the page file and swap file are configured differently when it comes to space allocation, reading and writing policies, and file size growth. Frequent access and updates to the swap file are fine, but would to be extremely inefficient with the page file. Likely it would create much fragmentation of long term dormant data in the page file if it was accessed and updated frequently which would defeat its purpose.

Because of the specific and more limited role, the swapfile.sys is usually only about 256 MB if system sufficient RAM memory is installed already. One of its main roles is to store Metro apps. This is because they need to be accessed in a different way to regular Windows apps and better suit how the swap file is managed.

How to delete Pagefile.sys and Swapfile.sys

Before deciding to delete these files and gain extra space, you should consider moving Pagefile.sys and Swapfile.sys to another drive in Windows 8/8.1/10. If you are set to delete them, here's how:

1. Press Win+R (or Win+S), enter SystemPropertiesPerformance, press Enter.

3 full Page File and Swap File explained How to delete Pagefilesys and Swapfilesys in Windows 8 or 10

2. Go to the Advanced tab. You will notice under Virtual memory the paging file size currently allocated.

3. Click on Change.

4. Uncheck Automatically manage paging file size for all drives.

5. Select No paging file, click Set. You'll be prompted to Restart.

4 large Page File and Swap File explained How to delete Pagefilesys and Swapfilesys in Windows 8 or 10

(Steps 2 to 5 from above)

That's it. Upon restart you'll notice that both Pagefile.sys and Swapfile.sys are gone.

Clearing the Page File on Restart

There is the option to clean the page file each time Windows shuts down. Windows uses the page file to save on RAM usage at times. This process overwrites the data with zeros in order to make it unreadable. This process is time consuming when needing to shutdown or reboot more quickly.

However, it is useful if working on confidential files which may still be stored in the page file to clear them out when shutting down or restarting Windows.

Here is the way to do this:

1. Open Regedit

2. Navigate to HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ Memory Management

3. Create a new entry in the right pane. DWORD 32-bit value ClearPageFileAtShutdown and set a value of 1

This will ensure that Windows 8/8.1/10 will properly wipe the page file at every shutdown or restart procedure.

Windows Drive Encryption

If a full security package is required to protect data in situations where the Windows operating system crashes before data can be safely overwritten then it is worth considering a package like TrueCrypt. This open source encryption software can encrypt the entire Windows drive so that the page file and swap file cannot even be located. This way, a stolen PC cannot be read for private data, passwords, photos, videos, and more.

See our latest article to learn more about hibernation process and the workings of the hiberfil.sys file in Windows 8/8.1/10.

Comments (8)
kshu's profile
kshu on 3 Sep 2015
I'm glad to hear that worked well for you :).
martineau's profile
martineau on 2 Sep 2015
Good news, I was able to get both the swapfile (and pagefile) moved to my S: swap partition using the mklink "trick" in the other article you mentioned (although for some reason it took two tries — the first time the symbolic link vanished and the swapfile ended up on the C: drive as usual). Thanks!
kshu's profile
kshu on 2 Sep 2015
On my Windows 10 virtual machine I managed to still have a Swapfile.sys file after doing all these settings above only if I did not set 'No paging file' for ALL drives. If I left 1 partition (not C) with paging file set, then swapfile.sys was there on C.

Still, I wasn't able to replicate your second case in which you still had both pagefile.sys and swapfile.sys on C.

For tricking Windows into moving the swapfile.sys file to your S swap partition, you can try this tutorial: http://www.download3k.com/articles/How-to-move-Pagefile.sys-and-Swapfile.sys-to-another-drive-in-Windows-8-8.1-or-10-00430.
martineau's profile
martineau on 2 Sep 2015
Sure, no problem — I'd them already just in case you wanted to see them.
The first, showing my virtual memory settings: http://imgur.com/4myyDY2
The second, showing contents of my C: drive after rebooting: http://imgur.com/FG5rMJ3
kshu's profile
kshu on 2 Sep 2015
@martineau, just to confirm this, can you upload screenshots to something like http://imgur.com/ and post the link(s) here so I can have a look? If you want that is, I'm just curious of why is this happening :).
Show more comments
martineau's profile
martineau on 1 Sep 2015
@kshu: Yes, I'm sure. Just set it again to "No paging file" and rebooted to make sure. Afterwards not only was there still a 256 Mb swapfile.sys, this time a 16 Mb pagefile.sys remained, too. I can provide links to some screenshots I made if you're interested. BTW, this is on a real, non-virtual, machine.
kshu's profile
kshu on 1 Sep 2015
Are you sure, martineau? I just tested this on my Win 10 VM (with the latest updates on) and both pagefile.sys and swapfile.sys are gone after doing the tutorial and restarting.
martineau's profile
martineau on 31 Aug 2015
On Windows 10, setting the "No paging file" option and rebooting only gets rid of pagefile.sys, but not swapfile.sys (not surprisingly, given the name of the option).
Featured Articles