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, 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.
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.