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.
- 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.