Helping people with computers... one answer at a time.
Hiberfil.sys and pagefile.sys are two system files used by Windows to support two very important features: hibernation and virtual memory.
I recently noticed two huge files named hiberfil.sys and pagefile.sys occupying something like 2.5GB. I can't delete 'em, or if I do they come back when I reboot. What are they and how do I get rid of them?
•
As you might guess, hiberfil.sys and pagefile.sys are two system files, managed by Windows.
They are support files for two features in Windows. While you might be able to get rid of them, you might not actually want to.
But you can at least manage one of them a little bit.
•
Hiberfil.sys
Hiberfil.sys, if present, lives in the root of your system drive (typically C:) and is the same size as the amount of RAM Windows sees installed in your machine. If Windows reports 2GB of RAM, then hiberfil.sys will be 2GB as well.
It's the support file for the hibernation feature in Windows. When your system goes into hibernation, Windows writes a complete copy of RAM to the file hiberfil.sys. When you turn the computer back on, the boot loader notices that the file has been placed into hibernation, and instead of booting Windows, it simply reloads this single file back into RAM.
The file is normally inaccessible. You can release Window's hold on the file by turning off hibernation. In Windows XP, that's in Control Panel, Power Options on the Hibernate tab:

In Windows Vista, things are a little more hidden, so we'll take a different approach.
Run a Windows Command Prompt as Administrator (right click on a shortcut to Windows Command Prompt and click "run as Administrator", or click on the start menu, type "cmd" into the search field and type CTRL+SHIFT+Enter). In that command prompt, type:
powercfg /hibernate off
Regardless of the method, hiberfil.sys either should now be gone, or you should be able to delete it yourself.
But you'll no longer be able to place your machine into hibernation.
•
Pagefile.sys
I've actually discussed pagefile.sys before. It's the system paging file - your virtual memory or "swap file". It's where Windows "swaps out" memory contents to make room for other things when the combination of software you're running requires more RAM than you actually have.
Pagefile.sys is always locked by the system as long as you have virtual memory enabled. That's also a clue as to one way to get rid of it: turn off virtual memory.
Or, if you prefer, move it to another drive.
In Windows XP, right click on My Computer, click on Properties, click on the Advanced tab, in the Performance section click on the Settings button, click on the Advanced tab, and finally click on the Change button within the Virtual Memory section.
In Windows Vista, the steps are similar: in the start menu right click on Computer, click on Properties, click on Advanced System Settings, in the Performance section click on the Settings button, click on the Advanced tab, and finally click on the Change button within the Virtual Memory section. In the resulting dialog you may also need to uncheck "Automatically manage paging file size for all drives" to be able to take control of settings yourself.
Here's mine, in Windows XP:

As you can see, you can select the size of the virtual memory file to be used per drive. I currently have "No paging file" on my C: drive, my system drive - there is no pagefile.sys there.
If you want no paging file at all, then simply make sure that "No paging file" is set for all drives. You may need to reboot, but after that pagefile.sys will either be gone or able to be deleted.
Caution: if you do this you have no virtual memory. That means that if your applications require more memory than you actually have installed they will fail. If you have lots of RAM, that may not be a problem, but if you have little RAM and/or run lots of programs at the same time, you probably do want a paging file.
One performance improvement is to move the paging file to another drive. As you can see in my example above the "D:" drive does have a paging file. Since Windows uses the system drive C: heavily, it's often convenient to move the paging file to another drive.
Make sure that the drive holding the paging file is a fast drive. Moving the paging file to an external USB drive, for example, while possible may result in a very slow system. The paging file should really only be placed on internal drives.
In general, unless you're battling some kind of performance or space issue, I typically recommend leaving the virtual memory and paging file options set to their defaults.
Article C3893 - October 8, 2009 « »
May 7, 2010 8:54 AM
I just scanned my computer for viruses and it reports the hiberfil.sys file infected. is it safe to remove it? as in will it be recreated automatically by windows if it is removed during an antivirus scan? or will removal disable the hibernation capacity?
08-May-2010
September 28, 2010 6:54 AM
Here is a question I haven't been able to find an answer to. I recently did a clean install of Windows XP Home Edition SP3 on a desktop. I never use hibernate. I noticed that hiberfil.sys was present and wasting disk space. However, there is no hibernate option in power options and powercfg at the command prompt indicates "system does not support hibernation" (no idea why not). The hiberfil.sys file is in use, cannot be deleted, and is timestamped same as pagefil.sys. Any ideas?
May 17, 2011 1:16 PM
What should I do if I only have one internal hard drive and the hiberfil.sys and pagefile.sys are seriously hurting the performance of my computer? Will disabling Hibernation make hiberfil.sys smaller? Is there any way to manually make either of them smaller?
17-May-2011
May 17, 2011 2:00 PM
@Charlie:
If you disable hibernation you will free up as much disk space as you have RAM. The hiberfil.sys is a copy of your RAM when you go into hibernation. If disabling hibernation doesn't get rid of your hiberfil.sys you may safely remove it manually.
June 7, 2012 11:21 PM
Really helpful.Thanks for the post.