Page File vs Swap File
Anyone who has used Windows for any length of time is familiar with the Page File. And anyone who is using a Solid State Drive (SSD) has probably moved the Page File to a mechanical drive to help minimize write operations on their SSD.
Note: Write operations on SSDs are not as bad as the hype will tell you. Under normal usage, today’s SSDs will last for five years or more barring any component malfunction. This is in line with the life expectancies of mechanical hard drives. Still, it doesn’t hurt to minimize writes to SSDs whenever possible.
I won’t deeply delve into the subject of moving or resizing the Page File in this article. There are countless posts on this subject all over the Internet and, as you might expect, DCT has its own which you can find right here: The Infamous Page File โ How Big, Where Should I Put It, and Do I Need It?
Note: The instructions in that article are for Windows 7, but they are still valid for Windows 8.x.
The New Swap File
I would like to focus instead on the new Swap File that has been implemented in Windows 8.x.
By default, it is located in the root directory of your operating system drive– normally the C drive when using Windows.
It is about 256 MegaBytes (MB) in size (mine is ~268).
It is called: swapfile.sys
The Swap File is used by Windows 8.x to swap out unused “metro” apps in order to make more memory available for active applications. This is similar to how the Page File is used but, in this case, is specifically for “metro” apps.
Note: Yes, yes, I know we’re not supposed to call them Metro anything anymore, but I’m older than Microsoft and Bill Gates, cranky, retired and have earned the right to call them anything I choose. Metro, it is.
Moving the Swap File
I’ve read many posts of late that say it can’t be done. Wrong! It can be done and I’m here to show you how simple it is.
Step One – Disabling the Page File
You can’t directly set Swap File sizes and locations as you can with the Page File, so we have to fool around a bit.
The first thing we want to do is get rid of the Swap File and we do this by getting rid of the Page File. Apparently, Windows figures if you don’t want a Page File, you don’t want a Swap File either.
Note: Click any of the images below for better viewing.
Here’s how:
Right-Click the Windows 8.x Start Button and choose System. This window should open:
Click Advanced system settings to get this:
Under the Advanced Tab, click the Settings Button. You should be here:
Under the Advanced Tab click the Change Button. Now we go to work:
The Virtual Memory Property Sheet
- Make sure the Check Box labeled Automatically manage paging file size for all drives is cleared
- Highlight each drive in turn
- Make sure the Radio Button labeled No paging file is selected
- Click the Set Button (very important or your changes will not take effect)
Do this for all drives on your system. They should all say None in the Page File Size column.
Note: Along the way, Windows may complain about having no Page File. For now, merely ignore this tedious whining by clicking the “Now, now, that’s OK” button.
Re-boot the computer when you are finished so your changes will take effect.
If you care to check the root directory of your Windows drive the swapfile.sys file should be gone. If not, you can now delete it like any other non-system file.
Step Two – Fooling Windows
Windows expects the Swap File to be in the Root Directory. We are going to let it believe the Swap File is still there by creating a pointer to another location.
As an example, I have a K drive where I keep temporary files, a Page File, browser caches, etc. That seems like a good place to put that Swap File, too.
To point Windows to that location you need to open a Command Box with Administrator Privileges.
The syntax for the mklink command is this: mklink <origin> <destination>
mklink c:\\swapfile.sys “<destination path>:\\swapfile.sys”
Note: If there are no spaces in the <destination path>, the quotation marks can be eliminated.
Using the K Drive example, mine would look like this: mklink c:\\swapfile.sys k:\\swapfile.sys
Hit <Enter> and close the Command Box if you don’t get an error. If you do get an error, it is probably a simple typo or spacing problem. Try again paying close attention to detail.
Note: To open an Admin Command Box in Windows 8.x, Right-Click the Start Button and choose: Command Prompt (Admin)
Step Three – Re-enabling a Page File
Even if you have oodles of memory (RAM) installed in your computer, I still recommend a minimal Page File enabled somewhere. Some older programs still expect one and even Windows likes to have one for memory dumps if errors should occur some day. That’s why it may have complained to you earlier. Well, we are now about to change its diaper.
Go back to Step One (above) and get back to that Virtual Memory window like you did before. Choose a drive for your Page File. I would suggest a Custom Size as opposed to a System Managed Page File. The reason is that Windows still holds to the old rule of multiplying the amount of installed RAM by 1.5 to determine the optimal Page File size. On my computer that would be about 24 Gigabytes (GB), and that’s just plain crazy talk.
With 16GB of RAM installed, I have a custom size Page File set to 1024 (min) and 1024 (max) on that K drive I told you about.
Note: A good reason for keeping a fixed size is to eliminate the potential for Page File fragmentation. Keep the minimum and maximum the same size to avoid this.
Don’t forget to hit that Set Button when you are done.
OK your way back through all those windows to the desktop and re-boot your computer for the changes to take effect. Do this even if Windows does not prompt you to do so– just to be sure.
Conclusion
After all that rigamarole you should have a reasonably sized Page File and a Swap File located somewhere other than on your precious SSD.
If you care to check this out, look in the root directory on your system drive. You should now see the swapfile.sys file taking zero bytes of space. The icon should have that familiar shortcut arrow superimposed on it as well. The destination path you chose should now contain theย real Swap File.
You should be happy, Windows should be happy– what more could you ask for? ๐ Don’t answer that. ๐
And they said it couldn’t be done. Ha!
Richard
—
swapfile.sys is locked and cannot be unlocked while win is running in normal mode. u better continue master BASIC with c64.
>the swapfile.sys file should be gone. If not, you can now delete it like any other non-system file.
it will not move anywhere if you just set another location for pagefile.sys
Hi Barrack,
You: “swapfile.sys is locked and cannot be unlocked while win is running in normal mode”
Me: I never said that it could
You: “it will not move anywhere if you just set another location for pagefile.sys”
Me: I never said that it would
Given that I wrote this a while back, and that I am not immune to error, I followed the steps in the post– just to make sure.
It all worked on my computer as the article stated.
You: “u better continue master BASIC with c64”
Me: Attempting to elevate one’s own position by demeaning others only belittles the speaker
Congratulations,
Richard