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
Leo,
Thanks for this and your other great articles. You really have a gift for writing with clarity and structuring your comments in a way that the information can easily be understood and followed.
I carefully followed your bulleted steps and was able to Set the drive (F:) on which I want the pagefile.sys to reside to System Managed Size. However, after selecting its current location (C:) and clicking No Paging File, when I then clicked the Set button, I got a System Properties pop-up saying:
"If you disable the paging file or set the initial size to less than 800 MB and a system error occurs, Windows might not record details that could help identify the problem. Do you want to continue?"
Not having seen mention of that pop-up in your instructions, I felt it prudent to ask about it before proceeding.
Thanks again,
My specs FYI:
•Processor: AMD Phenom(tm) II X6 1090T Processor 3.20 GHz
•Memory: 16.0 GB
•Operating System: Windows 7 Ultimate (64-bit)
•Drive C: Crucial 128GB SATA 6.0Gbps/2.5-inch Solid State Drive (CTFDDAC128MAG-1G1)
•Drive D: LG 12x SATA Blu-ray Writer Drive (WH12LS30K)
•Drive E: WD 500GB SATA 6.0Gbps/7200RPM/16MB/3.5-inch Internal HD (WD5000AAKX-001CA0)
•Drive F: Hitachi 1TB SATA 3.0Gbps/7200RPM/32MB/3.5-inch Internal HD (HDS721010CLA332)
•Drive G: Seagate 3TB SATA 6.0Gbps/7200RPM/64MB/3.5-inch Internal HD (ST3000DM001-9YN166)
•Drive J: WD 1TB USB 300Mbps/7200RPM/16MB External HD (WD 10EACS)
•Drive L: Seagate 300MB USB 100Mbps/7200RPM/8MB External HD (ST330083 1A)
•Video: ATI Radeon HD 5700 Series
20-Mar-2012
Thanks for the reply Leo.
After completing the steps and restarting my computer, I discovered in Windows Explorer that the amount of free space on my C drive had not changed. It still showed 18.5 GB free of 119 GB which is what it was before trying to remove the pagefile.sys file.
I went back into the Virtual Memory settings (C: > Properties > Advanced system settings > Advanced tab > Performance:Settings > Advanced tab > Virtual memory:Change > Virtual Memory settings) where I found that the "Paging file size for each drive" settings were as I had left them. In other words:
C: None
E: None
F: System managed
G: None
I cannot see the pagefile.sys file in Windows Explorer so I used TreeSize Free to examine the folders and files in the above drives. I found the following:
C:\[Files]\pagefile.sys — present (16.4 GB)
E:\ (none)
F:\[Files]\pagefile.sys — present (16.4 GB)
G:\ (none)
So that explains why no additional space has been freed up on Drive C but I don't understand how/why the file is still present on Drive C, since it displays "None" in the Virtual Memory settings.
Many thanks.
Posted by: Steve at March 20, 2012 9:14 PMLeo,
Please, I have a doubt and I think you can help me:
I tried to manage my pagefile of my XP to the drive D, I have C and D. But, after the reboot, I noticed that my drive D had even less space than before and there are two pagefile on my partitioned HD, one on C and the other on D, and then I turned it back to the way it was, on C, but the pagefile on D is still there, occupying 1,44GB there. Could I delete it or do my HD need two pagefiles? That second pagefile on D was not to be there, right? What can I do now? If you can help me with this, mate, I thank you in advance.
Regards,
Samuel
28-Mar-2012
Thanks a lot, Leo. Already deleted the obsolete pagefile and it's all right now. Thank you.
Posted by: Samuel at March 31, 2012 11:49 PMThank you very much. This post saved my life!
Posted by: Chris at May 10, 2012 4:17 PM