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.

Pagefile.sys

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:

"Be it for performance or for disk space, moving pagefile.sys is pretty easy."
  • 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.

Moving pagefile.sys

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:

Windows 7 Performance Options dialog

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

Click on Change...

Virtual Memory Settings in Windows 7

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:

Virtual Memory Settings in Windows 7 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 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

27 Comments
Mark Jacobs
July 4, 2010 1:05 AM

You mentioned that system managed size is appropriate. I set mine manually to 3gb because it seems to mee that the dynamic allocation of page file size could cause an occasional slowdown. Is this true or does dynamic allocation not slow things down?

If dynamic allocation happens at all it's extremely infrequent and only if actually needed. You'll note my pagefile.sys was set to my memory size (8gig). And yet my machine has NEVER needed to use any appreciable amount of VM. Let the system manage it - it's actually pretty good about it.
Leo
04-Jul-2010

Pat B
July 6, 2010 1:06 PM

How do I know if my (D) drive is an actual separate drive or just partitioned from the C Drive? It says "Factory Image" and only has 1.54 GB free of 11.2 GB. If it is a 2nd drive, would the size be adequate if I moved pagefile.sys to that drive?. Thanks

Fire up the disk manager (Right click on My Computer, click Manage and then click on Disk Mangement). It'll show you which partitions live on which physical drives.
Leo
07-Jul-2010

Daniel J. Smelko
July 6, 2010 4:41 PM

I tried moving the paging file on my computer, I have windows vista home premium sp 2. it didn't work the way it works for windows 7. When I restarted my computer and checked to see if it worked it showed none for all drives instead of "managed system" on the external drive I selected.

External Drive? Don't do that. It'll just slow down your system. I'll bet that Windows simply prevented that from happening. (My guess is that at boot time it tries to set up the page file before external drives have been detected.)
Leo
07-Jul-2010

Norman
July 6, 2010 8:29 PM

It works fine in XP with SP3 however, the display is slightly different than Win7; instead of "managed system" it displays the "Page file size" i.e. the amount of MBs you want, which in my case is the maximum 3070mb by clicking/using the "Custom Size" option.

Harrytherag
July 7, 2010 3:49 AM

I have two 300Gb hard drives set in a striped raid array and partitioned C - F so is there any point moving the swap file to F as it's not really on another hard drive?

Nope.
Leo
07-Jul-2010

Seth Mootchnik
July 7, 2010 9:57 AM

I tried this on my Win 7 (64 bit).
The page file did show up on my secondary internal drive, along with a duplicate (the other being on my Desktop) Recycle bin.
However,after the reboot I got an error- that my system created a temporary paging file on the C drive.

Any suggestions?

Douglas Gross
July 7, 2010 7:03 PM

Just an extra note, you can look up the speed of each internal drive you have. If your C drive is faster, keep it on the C drive. If your other internal drive is faster, of course you would want to use that one. Also, it is good to set up Windows to clear the paging file when it shuts down, but that is another discussion entirely that perhaps could be the making of another article here. Also, if you have a lot of RAM and a good processor, turning the paging file off is your best option option. DO NOT turn off the paging file on an older computer with very little RAM or slower processor. Also, decreasing the paging file on an older or slower computer may force Windows to increase the paging file when you reboot, and that means you will be staring at a screen for a very long time before you get into Windows again. That is because when Windows has to increase the paging file itself it takes its sweet time.

Robert DiGrazia
July 8, 2010 6:16 PM

I have two page files, on different disks, C and G.
I want Windows (XP Home) to prefer the file on G:, i.e. to use the file on C: only if the file on G: fills up.
Is there a way to tell Windows which file to prefer?

Douglas Gross
July 8, 2010 10:22 PM

@Robert

Been reading about this more and found this on Microsoft's site:

The optimal solution is to create one paging file that is stored on the boot partition, and then create one paging file on another partition that is less frequently accessed on a different physical hard disk if a different physical hard disk is available. Additionally, it is optimal to create the second paging file so that it exists on its own partition, with no data or operating-system-specific files. By design, Windows uses the paging file on the less frequently accessed partition over the paging file on the more heavily accessed boot partition. An internal algorithm is used to determine which paging file to use for virtual memory management.

Digital Artist
November 23, 2010 5:17 PM

Great technique for improving performance. For XP users like me, the clicks to do this are: Start;control panel;system;advanced;performance settings;advanced; and from there the rest is described in the article. I do a lot of photo manipulation on large images which are usually saved as bitmap (bmp) files, and frequently get windows messages saying that I do not have enough virtual memory. Well, I got enough now! Thanks, Leo!

Rocco
March 29, 2011 6:20 PM

That was awesome Leo. It worked perfect.
I have two drives: C is SSD Vertex 2 : 60 GB and second drive WD 1TGB with two partitions D: 800GB and G: 200GB. I have i7 2600K intel processor on Asus p8p67 and 8 GB memory on the machine I just build two days ago. SSD got filled so quick, just with programs, and i had left only 9.23 GB. After moving pagefiles I am back to 17GB free space. Thank you for your contribution.

JF
April 9, 2011 10:55 AM

Ok. I wanted to remove my pagefile from C: and stick it on D:. The result after having followed your instructions is that now I have TWO pagefiles. My D: now has a 14 GB, system managed pagefile and C: still has a 12 GB pagefile.sys file on it even thought the virtual memory dialogue shows C: as having "None". (I have 16 GB RAM). And of course I can't delete that leftover file on C: . Any ideas on how I get rid of it ?

Mark J
April 9, 2011 12:38 PM

If you can't delete your old pagefile.sys or any file for that matter you can use Unlocker http://unlocker.en.softonic.com/ . I've been able to delete or move any file that was locked.

Chris
May 5, 2011 4:16 AM

Thanks!
After moving from C-drive to D-drive and rebooting, I still had to manually remove the old pagefile.sys on the C-drive.

Uffe
November 20, 2011 1:04 PM

I can't help myself... The question of the topic, "What is pagefile.sys and can I move it?" sounds a little like "Who is general failure and what is he doing on my harddisk?"

somayeh
January 7, 2012 1:23 AM

thank you very much it helped a lot :)

keno28
March 15, 2012 7:46 PM

At first I thought this article would show me how to move the pagefile.sys to a different directory but it doesn't. So it begs for a question:

I have a dual boot PC. Can Windows 7 share the same pagefile.sys file with Windows Vista on the same drive? Thanks!

Kim
March 16, 2012 10:22 AM

Hi Leo,

Just wanted to say a big THANK YOU for this article! My SSD drive space has been steadily dwindling and I wasn't sure what I could do to remedy this. But I found your article & by following your detailed instructions, it helped me free up the space taken up by the pagefile.sys. Hooray!! :)

Kim

Steve
March 20, 2012 4:04 PM

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

Make certain that F: is set to have a paging file, and this warning can be ignored.
Leo
20-Mar-2012
Steve
March 20, 2012 9:14 PM

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.

Samuel Pelegrini
March 27, 2012 5:47 PM

Leo,

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

YOu can delete the pagefiles that are not in use. If Windows is actually using it then the delete will fail.
Leo
28-Mar-2012
Samuel
March 31, 2012 11:49 PM

Thanks a lot, Leo. Already deleted the obsolete pagefile and it's all right now. Thank you.

Chris
May 10, 2012 4:17 PM

Thank you very much. This post saved my life!

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

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

Paul
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

George Melendez
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

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to http://askleo.com/ask to ask your question.