9

I don't know how "Sleep" works (that is, whether it puts everything that's currently in DRAM main memory into hiberfil.sys and then when I wake up the system it load everything back into memory).

I currently have 16 GB RAM and Windows 7 64-bit on a M4 128 GB SSD.

hiberfil.sys is taking up 12 GB of valuable SSD space. Needless to say, I want to free it up.

9

hiberfil.sys is used by Hibernate, not by Sleep. The only surefire method of disabling Hibernate, and thus removing hiberfil.sys, on Windows Vista and Windows 7, is through the command prompt and the following steps:

  1. Open a command prompt with administrative privileges.
  2. Enter “powercfg.exe -h off”.
  3. Exit the command prompt.
| improve this answer | |
  • thanks this worked. i didnt see "hibernate" listed among the options. does "sleep" still keep the RAM modules powered? so all it basically does is shut down the disk drives? – Wuschelbeutel Kartoffelhuhn Aug 13 '12 at 10:23
  • AFAIK, Sleep only keeps the RAM modules powered, everything else is shut down – alexs Aug 13 '12 at 10:42
  • This is incorrect. See more complete information in my answer. – Corporate Geek Aug 13 '12 at 13:21
  • It works! I just reclaimed 4 GB on an old system (but still Windows 7) that was low on disk space. hiberfil.sys was deleted immediately, without any need for a restart. – Peter Mortensen Apr 17 '15 at 8:07
10

You should not delete this file. Sleep and Hibernate work together in Windows 7 and Windows 8.

Windows 7 has a mode named hybrid sleep, used on desktop computers. To quote Microsoft:

Hybrid sleep is designed primarily for desktop computers. Hybrid sleep is a combination of sleep and hibernate—it puts any open documents and programs in memory and on your hard disk, and then puts your computer into a low-power state so that you can quickly resume your work. That way, if a power failure occurs, Windows can restore your work from your hard disk. When hybrid sleep is turned on, putting your computer into sleep automatically puts your computer into hybrid sleep. Hybrid sleep is typically turned on by default on desktop computers.

Also, on laptops, if your laptop battery charge gets critically low while the computer is asleep, Windows automatically puts the laptop into hibernation mode.

Therefore, do not delete this file, unless you turn off both Sleep and Hibernation in your active power plan.

For more information on Sleep and Hibernation, I recommend reading this FAQ: Sleep and hibernation: frequently asked questions.

| improve this answer | |
  • There is no way to control the amount of space hiberfil.sys file takes? – Boris_yo Sep 4 '12 at 13:53
  • None that I know of. At least not without some serious hacking. :) – Corporate Geek Sep 5 '12 at 14:11
  • 1
    @Corporate Geek: i have woken up my desktop from sleep many times with hyberfil.sys being gone (via the method int he other answer) – Wuschelbeutel Kartoffelhuhn Sep 30 '12 at 23:49
  • did you have any power failures? Microsoft quoted by CorporateGeek says it is needed when power fails. – vinnief May 24 '16 at 5:17
2

The accepted answer by alexs was -almost- right for me, with only the small variation that I had to use slash instead of minus:

powercfg /h off

OS: Windows 7 Professional

Please see the accepted answer here for more details: Using Powercfg to remove Hibernation file does not work , even though I am the Administrator

| improve this answer | |
  • 1
    Welcome on SuperUser dracuella... Please specify your Windows version, it can be useful for other readers. My personal convincement is that a slash, /, sound more windows-like meanwhile a minus, -, more Unix-like. With modern versions of the programs It should work with any of them, but it depends from the implementation. Just one general note, the options are provided with a minus that can be different form the Hypen character... (so we can explain why, sometimes, to copy and past from some sites it will produce error...). – Hastur Sep 22 '16 at 11:23
  • @hastur powercfg /? list all options as start with -... – DavidPostill Sep 23 '16 at 7:04
  • @Hastur, added OS and changed 'hyphen' to 'minus' - I didn't know there was a difference. Also, I did a powercfg /? first which gave me the -h but having no luck with it, I googled and found the link I posted which solved my problem. – dracuella Sep 23 '16 at 11:14
1

You can change the size of hiberfile.sys, on Win7-Win10 by opening an elevated command prompt

  • press the windows key
  • type "cmd"
  • right-click on "cmd" in the list that pops up
  • choose "run as administrator"

then type the the command,

Powercfg –h –size percentsize 

replace percentsize with your value (for example, 60%), but it cannot be smaller than 50. See here for some pics.

| improve this answer | |
1

After so many years, Windows 10 has become the most popular system now. In case somebody wants to delete this file on Windows 10, I have something to remind you before you do so.

If you disable the hibernation function using "powercfg.exe -h off" on Windows 10, you will lose the fast startup function too. Because the fast startup function needs this file.

So, if your disk space is not that small, it's better not to turn off the hibernation function on Windows 10.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.