What are hiberfil.sys and pagefile.sys files, and can I safely delete them?

I noticed two big (~ 2GB) files (hiberfil.sys and pagefile.sys) at the root of my C: drive and wondered what they were. I searched on google and found some interesting links, but did not find any answer on this site. I guess it would be good to have this question answered here for future reference.

Here are my questions:

  • What is the file hiberfil.sys for?
  • What is the file pagefile.sys for?
  • Can I safely delete these files?

Solution 1:

hiberfil.sys: is a file used by Windows when you choose to 'Hibernate' the system. Take a look at this site on how to delete it, if you won't use the Hibernate option. In short, you run powercfg -h off in a command terminal with administrator privileges. The file should then be automatically deleted, and the Windows hibernation feature disabled.

pagefile.sys: is the file used by Windows to be your Page File, or your virtual memory swap. If you have 1 GB of RAM and want to use 2 GB as your memory, Windows will create a 1 GB virtual memory in your HD and use it as needed. See this site on how to delete it.

Can you delete them? Yes, but not by simply going to the Windows Explorer and removing them. Take a look at the provided links, or do some research about your Windows version, to know how to delete them.

Notice that simply deleting them is not enough: you'll have to disable the hibernate option and the virtual memory use of your Windows.

Solution 2:

Hiberfil.sys, as the name suggests, is the file to which Windows saves the snap shot data. Thus, the file is always equal in size to the total amount of available RAM on the computer.

To remove the file and disable hibernation.

1.Open a command prompt with administrative privileges.
2.Enter “powercfg.exe -h off”.

Pagefile.sys is the Windows paging file, also known as the file that Windows uses as Virtual Memory. And as such should not be delete.

Solution 3:

hiberfil.sys is the hibernation file, where Windows writes the contents of your system's memory when it hibernates. I believe that should be safe to delete while your system is running, but I'd like to get confirmation from someone who knows Windows better before you do anything.

pagefile.sys is the, well, pagefile, analogous to the swap partition on Linux (if that helps at all). The system uses it for extra memory when it runs out of space in RAM (it 'pages' it out to this file, thus 'pagefile'). It's extremely (relative to RAM) slow, but usually better than running out of memory altogether. You should NOT delete this file, at least while the system is running.

Edit:-

You can control the existence and size of the pagefile, at least in XP: System Properties->Advanced->Performance/Settings->Advanced/Change.