Helping people with computers... one answer at a time.
If you've added a hard drive to your system you can move pagefile.sys to free up space on your original drive and speed up your system.
There's a large hidden file on my disk that's taking up a bunch of space called pagefile.sys. What is pagefile.sys? Assuming it's something I need, can I move it to another drive?
•
Pagefile.sys is your Windows virtual memory swap file. When the applications you're running on your computer end up needing more RAM than you actually have, Windows will start shuffling things around and use your hard disk as "virtual" memory. At the sometimes high cost of speed (your hard disk, and thus virtual memory, is much slower than actual RAM) you avoid getting an out of memory error.
Pagefile.sys is the area that Windows sets aside for that.
And yes, you can move it. In fact, if you have more than one drive installed on your machine and your system uses virtual memory often, moving it can result in a performance boost.
•
When Windows creates pagefile.sys it typically makes it a "large" size - usually the size of RAM installed on your machine. For example on the machine I'm using now I have 8 gigabytes of RAM, and sure enough:
C:\> dir /a:h
...
07/03/2010 06:07 AM 8,589,008,896 pagefile.sys
...
(In the Windows command shell, "dir" lists the directory contents, and "/a:h" indicates that it should list files whose attributes include hidden.)
Particularly if you never use the paging file, that's space wasted.
In addition, if you have an additional hard drive installed in your machine it can often be helpful to place the paging file on a different drive. Not only does this free up space on "C:", but it can reduce hard disk contention caused by heavy use of C: by offloading some of the activity to a different drive.
Caveats:
It needs to be a different physical drive. Moving the paging file to a different partition on the same drive will probably just slow things down further as the disk heads on that drive need to move further as they access information from the original drive and the new location of the paging file.
It should not be on a USB (or Firewire) external drive. Not only are these interfaces often too slow to positively impact performance, accidentally pulling the cable will crash your machine.
It should not be a flash drive. Flash memory wears out, and heavy swap file usage can wear out flash memory exceptionally quickly.
But if you have a second, internal drive, then moving pagefile.sys is very easy.
Right click on "My Computer", or the "Computer" item in your start menu and click on properties.
In Windows 7 click on the Advanced system settings link.
Click on the Advanced tab.
In the box labeled "Performance", click on the Settings button.
Click on the Advanced tab in the resulting dialog.
That long, strange sequence should have you looking at a dialog similar to this:

Therein you'll see the "Virtual memory" section showing how much space has been set aside for your paging files.
Click on Change...

As you can see, the default is to have the system manage your paging file size for you, and in my case it's placed the entire file on my C: drive.
To change that:
uncheck the "Automatically manage paging file size for all drives" setting (Win 7).
click on the drive you want to move pagefile.sys to
click on System Managed Size
click Set
click on the drive currently holding pagefile.sys (probably C:)
click on No paging file
click Set
click on OK
Here's mine after the change:

You may need to reboot for the changes to take effect, but that's all there is to it. After the changes above and a reboot pagefile.sys was removed from C: and appeared on D:.
Some notes about the choices made above:
"System Managed Size" is appropriate, unless you have a specific reason to need it to be otherwise. Most people do not.
Of the drives that showed as available on my machine only C: and D: were appropriate locations for the paging file. B: is USB drive, and F: and P: are both TrueCrypt volumes. Only C: and D: are real internal and separate drives.
If only C: is listed on your machine, then you have nowhere to move your paging file to. You can run without virtual memory if you like - but depending on how you use your computer you may run into out of memory situations much sooner.
Be it for performance or for disk space, moving pagefile.sys is pretty easy.
Article C4359 - July 3, 2010 « »
May 10, 2012 4:17 PM
Thank you very much. This post saved my life!
August 26, 2012 9:38 AM
Hi, Leo.
Admirable how clear and clever responses you post. thanks for the passion.
On my office laptop i have just one disk.
The it guys as a policy install McAfee Antivirus(tm) and lots of things and on top of that McAfee End Point encription(tm), and on top of that the policies for the antivirus may not changed and those keep all day slowing down the computer with scans that never end and restart from scratch if i reboot.
So in two words, the antivirus keeps running all day and the encrypter keeps encrypting everything that is written to the disk and decrypting everything read from the disk.
I know how to counter-fight some things. One that i know to work is to keep pagefile.sys at (sufficient) fixed size (1,5 times the size for RAM when it's bigger than 2GB) and near the start of the disk.
This avoids it from fragmentation and speed up writes and reads of VM. With Defraggler i defragment my disk and send all the files smaller than 5MB to the end of the file. Then i erase the pagefile.sys file and recreate.
Then defragment again specifying that large files (375MB) stay at the end of the disk while smaller ones return back to the beginning of the disk, but ---after--- the pagefile.sys file :)
This basically will rise up the position of this special file in the disk. But dumb Windows XP now is not creating a file with the size i need (instead much more smaller) and is putting it near the middle of the disk.
After all this explanation, my question is: How may i move the pagefile.sys to the beginning of the free space on the disk without reinstall Windows?. Using a second a second disk is not an option. The Microsoft(tm) Pagedefrag utility does not help too much if the file is not fragmented.
Thanks in advance.
October 24, 2012 5:46 PM
The pagefile.sys file is similar to the older windows operating swap file. These always helped your computer to run faster if they were placed in a small seperate partition. The pagefile.sys does a similar job but a bit more sophisticated. Personally I never have any problems with my xp system and leave it to the XP system to create and handle this sometimes large file.
December 27, 2012 6:02 PM
Hi Leo,
I trying to move pagefile.sys to D from C I got the following message from Windows; should I be concerned?
---------------------------
System Properties
---------------------------
If you disable the paging file or set the initial size to less than 200 megabytes and a system error occurs, Windows might not record details that could help identify the problem. Do you want to continue?
---------------------------
Yes No
---------------------------
Thanks, Paul
February 24, 2013 4:53 PM
Hi Leo,
Thanks so much for the info on the 'virtual memory' (page files) you offered and I did what you said and my PC is running just GREAT. Now I understand the importance of these files and why it can be beneficial to have them stored on an alternative drive other than 'C'. That way my 'C' drive won't get bogged down and the 'D' drive can take care of these files with no hassle at all. One question, are these files later stored as 'temp files' or does WINS 7 automatically delete them when 'virtual memory' is needed again? Again, thanks for your time. It is appreciated.
George Melendez