Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

What Are Hiberfil.sys and Pagefile.sys, and How Do I Remove Them?

I recently noticed two huge files named hiberfil.sys and pagefile.sys taking up a bunch of space on my disk. 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?

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

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

Turning off hibernation

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.

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

Virtual Memory Settings

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.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

Podcast audio

Play

10 comments on “What Are Hiberfil.sys and Pagefile.sys, and How Do I Remove Them?”

  1. Just to clarify a point. When Leo refers to another “drive” he means a second physical internal hard drive. He does not simply mean another drive letter.

    I say this because drive letters can be separate partitions on a single hard disk and there are recommendations online about putting the paging/swap file in its own partition. I don’t think this is a good idea as it just increases the distance the r/w heads have to move.

    Windows on hard disk 1 and the page/swap file on hard disk 2 should give you the best possible performance. Needless to say, laptop users need not apply.

    Thanks for that catch: yes, if you want to move your paging file for performance it should be movd to a separate physical drive. Moving it to a separate partition on the same physical drive won’t help matters.

    Leo
    09-Oct-2009
  2. Why in the world would anyone want to remove hiberfil.sys or pagefile.sys? Seems to me they are asking for trouble somewhere down the road.

  3. Actually, if you have an IDE HDD, you get worse performance sticking it on a separate drive to windows, unless that drive is on a separate IDE controller, as the IDE controller only accepts data from one device at a time. If both HDD’s are on the same controller then when the windows drive will ask for something from the pagefile, it has to wait for the pagefile drive to finish before it can continue its work.

  4. I, and most Power Users, strongly reccommend against no virtual memory. First, It will cause your RAM use to jump to nearly full when running, say, 3 IEs with 3 windows open each. Then, if an application needs more memory, it may overwrite its assigned memory with the results being anything form an application crash to the Blue Screen of Death (BSoD) . Of course, if you have lots of RAM installed it may never happen. However, if (as sometimes happens) microsoft puts out an update that is buggy, it may use all you memory before you computer is done stating up, with the results being your system unable to load. (This actually happened to my friend, we had to boot into the WRC, ugh….. =)). So, the bottom line is : don’t do it. You are inviting trouble.

  5. I’ve found that it’s almost, if not totally, impossible to run without any virtual memory allocated.

    One other tweak I like to do is to change the virtual memory max and min values to be the same. 10, 20 years ago Hard Drives were measured in 10’s and 100’s of Mega, not Giga bytes. Back then it made economic sense to minimize use of relatively expensive disk space. So Windows was allowed to expand and shrink the swap file within the range specified. These days with common HD in laptops measuring 100’s GB assigning 1-4GB to swap file is not as significant.

    By setting definition of swap file to a constant size Windows creates it once and leaves it. After you have run an competent Defrag tool in a boot time defrag a couple of times it will eventually consolidate the swap file into a single contiguous file (or at most a few large fragments). No longer will growth and shrinkage of swap file contribute to fragmentation of data files or application files during new app installs.

  6. 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?

    You should be able to remove it. As always, make sure you’re backed up first.

    Leo
    08-May-2010

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

  8. 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?

    The article kinda covers this: If you disable hibernation you can delete hiberfil.

    Leo
    17-May-2011

  9. @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.

Comments are closed.