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.
Become a Patron of Ask Leo! and go ad-free!
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:
- 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:
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.
You mentioned that system managed size is appropriate. I set mine manually to 3gb because it seems to me that the dynamic allocation of page file size could cause an occasional slowdown. Is this true or does dynamic allocation not slow things down?
04-Jul-2010
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
07-Jul-2010
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.
07-Jul-2010
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.
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?
07-Jul-2010
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?
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.
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?
@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.
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!
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.
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 ?
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 almost any file that was locked.
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.
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!
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
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.
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
28-Mar-2012
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.
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.
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
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
Hello, can i use WinDirStat to just delete the Pagefile?
No. If you have a paging file configured then it is “in use” and cannot be deleted. If you configure no paging file then you can delete the file like any other without needing a special utility.
Dear Leo, your article on the paging file problem really solved a huge issue for me. for days i had been downloading file trackers, killdisks etc to no avail, then i found your post. thank you ever so much.
unfortunately i do have a problem. the reason i had been working on the paging file problem was i needed to free my d drive so i can merge with my c drive. the c drive being the main drive. the page.sys file was on the d drive and i was hoping after removing it i could format and merge with the c. i was able to format the d but the c is not giving me the option to “extend partition”. is there anyway you can help me? i moved the page.sys file to the e drive. is this affecting the process? does the page.sys file have to be on the c drive? (theres no more space on the c drive and i havent downloaded or installed anything that can free the 1.8g i need to transfer the pagesys file onto the c with.
i bought the laptop with windows 7 already configured on it. the c drive was, oddly enough given only 25g space while the other three drives were broken into roughly 90g each. i have merged the e and f drives now making them e but the problem is with merging the c and d. c doesnt give the option i stated above.
i am on the verge of reinstalling windows 7 but i am pretty sure this can be done without reinstalling. please help me. i hope your reply will hit my mail ad too. thanks so much for all already and in advance too.
can you please tell me about the pagefile.sys extention information .give me some idea about .sys file? it means only system file or it has some structure like other files such as .txt ?
.sys is an extension which stands for System. The extension of a file name doesn’t have any special properties in and of itself. It is used as an identifier. In most cases, they can be associated with a specific program, so that when you double click on the file, it is automatically opened. This isn’t the case with .sys files which are generally used by Windows and other programs for various purposes. Pagefile.sys as the article states is to hold information that doesn’t fit in RAM. Hiberfil.sys stores the entire contents of RAM when the computer is place in hibernation mode. Config.sys was a file in DOS which contained user settings for the OS. So you see, it can be used for different kinds of things.
what i s the difference between txt and .sys file ? please give the answer at the earliest
Other than an a general naming convention, there is no real difference between a .txt file and a .sys file. For example, I could rename a photograph with a .sys extension. If I double click on it, Windows would give me a message that it doesn’t know how to open it and offer to allow me to associate a program with it (unless somehow someone or some program has already don that). As I mentioned earlier, the extension in and of itself has no special properties other than the fact that you can associate it with a program that will open it when you double click on it.
Is there any structure available for the pagefile.sys?
There is no structure of a paging file. It contains information temporarily moved out of RAM and moved back in as necessary.
Thank you for the above responses. And i have one more doubt about pagefile how to analyse pagefile using data structures and signatures?
That’s much too broad a question. Generally the pagefile cannot be analysed other than by forensic means.
Thank you so much for the information in the article. More than just how to steps. I was interested to know about flash drives wearing out. Is this still the case?
I assume this is the same tech used in the SSDs that are gaining so much popularity. I have a convertible laptop with a 60GB ssd in the tablet and a 500GB hdd in the keyboard dock. Naturally space on C: has become an issue. Moving pictures and vids of my kids to the hdd has left me with 14GB free on C:. Most of the time tablet remains docked. But on occasion it may become undocked so moving the pagefile is not a good option. Plus I do not know the actual data connection so there may not be performance advantage like you mentioned. But how concerned should I be with the possible failure of my ssd if it is doing all the program and pagefile and hiberfil work?
Is it save to move the hiberfil to the dock drive in my system?
SSDs are essentially a fast high quality kind of flash memory. SSDs have been in use for a number of years, and I haven’t heard of any large numbers of SSD failures. Under normal use it wouldn’t be a problem. As for the swap drive, it should be on the SSD if at all possible as a swap drive on an HD is often a factor in a computer running slow. It applies to a much lesser degree to the hiberfil because that is only written to when putting the machine to sleep. And the hiberfil doesn’t constantly write to the drive making wear and tear a very small issue. As I said, if SSDs wearing out were a common problem, you’d be hearing a lot about those failures. Just be sure to back up.
SSDs are more expensive and higher quality than thumbdrives. It’s typically safe to put the pagefile on one. (Better yet is to have enough RAM so that you don’t need a pagefile at all.)
Hi Leo. Thanks for your expert advise. I just followed your procedure to move my swap file from C to E in a partition labeled Swap File. I will be watching to see if I notice any changes in the performance of my computer. If I wanted to put the swap file back to the original drive, which was C, do I follow the exact procedure that I did to move it from C to E?
Basically, yes.
Leo, in the article you mentioned the need to uncheck the “Automatically manage paging file size for all drives” setting before changing/moving the pagefile.sys to another drive. After that is done, do you need to re-enable that box again? That was not mentioned anywhere.
Also, I have a small SSD with the operating system (C:) and a rather large (1TB) HDD. I would like to put the pagefile.sys which is about 2.5GB on the large HDD. Is that OK or is that not advisable because the HDD is slower than the SSD? This is the impression I get from the answer of Mark Jacobs (Team Leo) from March 30, 2016.
I’d leave it off. I believe turning it back on will re-create a paging file on your original location. HD is fine … by the time you need a paging file your system fill be slowish to begin with (being low on RAM, which is when the paging file most frequently kicks in). I like the idea of keeping it off the SSD, just for longevity. Though you may want to experiment — SSDs are lasting longer than originally, and you may find that putting it on the SSD is faster for however it is you use your computer. There’s no single answer here.
Thank you for your reply. But this brings up another question regarding some other .sys files that I noticed. There is a hiberfil.sys file on the C: drive (SSD) at 6.6GB that is even larger than the pagefile.sys size. Can this file also be moved to the HDD? The other file is the swapfile.sys, but that one is only 262MB and I can leave that on the SSD. Thank you.
No, hiberfile.sys can’t be moved. (Has to do with the way hibernation works). You can only turn it off.
As part of one of Samsung’s power recommendations, I reduced the page file to a minimum of 200MB & max of 1,024MB, later would lower the latter to 800MB. Works fine, of course there’s 20GB DDR3 1600MHz RAM installed in the system, could likely get away with disabling the pagefile.
It kind of baffles me (at times) when I get a ‘low memory’ popup when not even half of the 20GB is used. Same with two 32GB systems. Having a smaller pagefile forces the RAM to do what it’s supposed to, it’s duty. Why have so much RAM & memory operations are performed on a SSD or HDD? Am not sure if a Microsoft engineer could answer the question, what I do know is the same doesn’t happen when running Linux Mint 19 on the same machines. Even with 25+ pages of Google Chrome tabs open, it’s rare to use 6GB, have yet to see it using 8GB.
Considering in 2018 that most any decent computer has 8GB RAM installed (needed for Windows 10 bloat), these are items still of great relevance. It’s simply recommended to keep pagefile low when running any brand of SSD & FastBoot/Hibernation disabled (open cmd as Administrator & type powercfg -f off & this allows for a normal shutdown, saving wear & tear on the computer. Those who wants or needs to open a computer & not lose their spot can still use sleep. Hibernation is a SSD killer, creating massive writes every time, this includes using FastBoot.
Only use the recommended settings if running a HDD only system, and there’s no SSD being used as a cache drive. FastBoot is a gimmick to make consumers think that low cost Windows computers ‘boots’ fast & if on a HDD only system, is OK to use. However this being 2018 & now with many on NVMe type SSD, stay away from these old school practices, or be prepared to replace these expensive drives long before needed. In an ideal world, these type of drives, as well as the 2.5″ variant, should last for the life of the machine. If running Windows 10, beware when each OS upgrades to a newer one, will have to change settings again. Microsoft has no respect for what we want, only what they want to feed us. If so, these settings created would be left untouched.
Bottom line, physical RAM is the fastest storage one has, better to force the machine to use it & pagefile less.
OK, how about this.
Put the paging file, and hibernation file in a physically separate SSD drive. Like a SATA, or M2. So when the OS is running, it can do simultaneous overlaping reads, one from the normal OS drive, and one for the pagefile.sys file off the other separate physical disk. This might speed up booting, and certain memory intensive activities. The hiberfile will speed up coming out of hibernation. I suspect the improvement would be little if any.
Ever since switching to an SSD system drive, I’ve found that I don’t need to use hibernation anymore. My machine boots up in under 2 minutes. Hibernation might shave of a few seconds but I’m happy with that startup time and prefer the extra disk space.