Hiberfil.sys and pagefile.sys are support files for two features in Windows. While you might be able to get rid of them, you might not actually want to.
Become a Patron of Ask Leo! and go ad-free!
Hiberfil.sys, if present, lives in the root of your system drive (typically C:). It may be present if your hardware supports hibernation, and is the support file for that feature. 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 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.
Run a Windows Command Prompt as Administrator (right-click on a shortcut to Windows Command Prompt and click Run as Administrator). In that command prompt, type:
powercfg /hibernate off
Hiberfil.sys should now either be gone or you should be able to delete it yourself.
You’ll no longer be able to place your machine into hibernation. You can turn it back on again by replacing the “off” with “on” in the command above.
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 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 7, click on the Start menu, right-click on Computer, and click on Properties. In Windows 10, right-click on the Start menu, click on System, and scroll down the right-hand pane, if needed, to expose and click on System info.
Then, in either version, click on Advanced System Settings. In the Performance section, click on the Settings button, on the Advanced tab, and finally 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.
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, and there is no pagefile.sys there.
If you want no paging file at all, simply make sure “No paging file” is set for all drives. You may need to reboot, but after that, pagefile.sys will either be gone or can be deleted.
Running with no VM
When you run with no virtual memory, it 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 want a paging file.
One performance improvement is to move the paging file to another drive. Since Windows uses the system drive C: heavily, it’s often convenient to move the paging file to another drive. Simply set the size of the drive on C: to “No paging file” and then set the paging file on another drive to be “System managed size”.
Important: make sure 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 only be placed on internal drives.
In general, unless you’re battling some kind of performance or space issue, I recommend leaving the virtual memory and paging file options set to their defaults.
Subscribe to Confident Computing! More confidence & less frustration -- solutions, answers, & tips -- in your inbox every week.
I'll see you there!