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.

"When your system goes into hibernation, Windows writes a complete copy of RAM to the file hiberfil.sys."

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:

XP: Power Options Hibername Option

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:

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, 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 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

10 Comments
Michael Horowitz
October 8, 2009 12:59 PM

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
Irving Waldorf
October 13, 2009 4:20 PM

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.

Pookey
October 13, 2009 4:48 PM

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.

Scott
October 13, 2009 6:25 PM

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.

ron
October 13, 2009 10:35 PM

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.

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

You should be able to remove it. As always, make sure you're backed up first.
Leo
08-May-2010

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

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

The article kinda covers this: If you disable hibernation you can delete hiberfil.
Leo
17-May-2011

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

Hanuman
June 7, 2012 11:21 PM

Really helpful.Thanks for the post.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to http://askleo.com/ask to ask your question.