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:
(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.)
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.