Helping people with computers... one answer at a time.

Pagefile.sys is the "paging file" or system file that contains Windows Virtual memory. You can remove it - if you understand the ramifications.

How to delete pagefile.sys. Is it safe to delete?

Sure, you can delete it. It takes some special steps, but it's not really all that difficult.

The problem is that you probably don't want to.

Pagefile.sys is the Windows paging file, also known as the file that Windows uses as Virtual Memory. As I've discussed before, Virtual Memory is simply disk space that Windows uses when it runs out of physical memory or RAM. Some of the contents of RAM are written out to disk to make room for whatever other memory request might have come in. If that "paged out" memory is needed again, some other RAM is written to disk and the previously written information is read back in.

Pagefile.sys is the file where Windows keeps all that:

Windows Explorer showing pagefile.sys

(Note that pagefile.sys is a system file, and thus in order to see the file in Windows Explorer "Show hidden files and folders" should be enabled and "Hide protected operating system files" should be disabled.)

"... Virtual Memory is simply disk space that Windows uses when it runs out of physical memory or RAM."

Now, since the file is being used by Windows, you can't just delete it. It'll either tell you permission denied, or "file in use" or something like that. Extra steps are required.

You'll probably notice that your paging file is roughly the same size as your configured virtual memory settings.

This leads to our first way to get rid of it: set your Virtual Memory to zero, and reboot. Once you return, Windows will no longer be using the file, and thus you can delete it.

If you have enough RAM in your system to handle the amount of memory needed to run the programs you run, you may not need VM at all. That happens to be how I run. (In fact, in researching this article I noticed I had a pagefile.sys when I did not expect one. I'd simply forgotten to delete it after setting my Virtual Memory to zero.)

Pagefile.sys will return if you re-enable virtual memory.

The other approach to deleting pagefile.sys is less useful, but I'll include it for completeness: boot into another operating system, and delete the file.

Quite literally, if you were to boot from a Linux Live CD, and explore your Windows hard drive you'll find, and should be able to delete, pagefile.sys.

We've done exactly what you asked for, but there's a problem.

As soon as you boot Windows, if you have Virtual Memory configured, pagefile.sys will return.

This approach is benign, but I'm guessing this isn't really what you were after.

Ultimately, unless you have some reason to be playing with your Virtual Memory settings, or know that you can run without Virtual Memory at all, I suggest simply leaving the settings, and pagefile.sys, the way they are.

Article C3603 - December 27, 2008 « »

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?

Recent Comments
21 Comments
indnajns
August 18, 2011 4:50 AM

Your second delete suggestion has a great use - when pagefile.sys gets infected with a virus. My antivirus is having issues removing it. Now that I know how to manually remove it, I'll fix the problem myself. Thanks!

Cody S
July 8, 2012 1:16 PM

As a note to deleting from another OS like a Linux Live CD:

This could be a good option for someone who has an infected pagefile.sys. Some viruses can hide out in there, so successfully deleting it from another OS can be useful (even though windows will create a fresh version on next boot)

aaron
October 19, 2012 3:36 PM

i deleted pagefile.sys with cmd and gained 7 gb.

aaron
October 19, 2012 3:40 PM

mine may be infected.notice that i disabled the pagefile

DaveMReed
March 14, 2013 3:30 PM

Thank you again for your very helpful and informative articles!

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.