How to Disable Hibernation and Delete hiberfil.sys File in Windows 7

I recently addded 6 GB memory to my Core i7 workstation to be able to run multiple virtual machines at the same time. It’s not long before I found an issue with this setup. The partition for my Windows 7 is only 40GB. Even thought I didn’t install a lot of programs, my system drive ran out of disk space pretty quickly. I was puzzled at first. Then I realized the hibernation file takes a lot of disk space even though I don’t use it.

The hibernation file is called hiberfil.sys and it’s under the root of the system drive. It’s the file that system writes the contents of physical memory to when you put the computer to hibernation. The size is uaually the size of your physical memory. For my Core i7 machine with 9 GB of total memory, the hiberfil.sys is about 7 GB which takes up a lot of space.

If you use the power options in Control Panel, you can turn off hibernation. However, the hibernation file remains. To disable hibernation and delete the hibernation file, you have to use powercfg command line tool. Follow these steps.

  1. Open up an elevated command prompt.
  2. Type this command.
    powercfg -h off

That’s it. If you ever want to turn it back on. Just type powercfg -h on .

23 thoughts on “How to Disable Hibernation and Delete hiberfil.sys File in Windows 7

  1. PuffMaN

    oh man u saved my day.. i tried deleting it in linux on the same box after disabling hybernation in the power options, but it always came back..

    i got a 30GB SSD drive which contains my Win7, so i really can use the extra 4gb

    Reply
  2. Gintus Mcgloski

    That is awesome. I have a 32GB ssd boot drive and was loosing space fast. this gave me back close to 4GB .
    Thanks heaps!!

    Reply
  3. blah blah black sheep

    The stupid thing about this (Win7) is that in WinXP you used to be able to disable this directly from Control Panel > Power Options … just uncheck “hibernate”, and it would go away. But in Win 7, even though you disable hibernate in power profiles (IE: Hibernate = Never), it still keeps this damn file around. You have to manually hack it via the command line.

    For folks finding it annoying opening the cmd as admin, an alternate method would be to

    1) Create a new .txt file
    2) Copy/paste “powercfg.exe -h off” into it
    3) Save As or Rename the file to “power.bat”
    4) Right-click on it
    5) Choose “Run as admin”

    That will fire off the command as a batch file in admin mode and do the exact same thing. When you’re done, you can delete the file, or right-click edit the file to “powercfg.exe -h on” and keep the file some where in case you want to turn it back on some day.

    Reply
  4. Uther Lightbringer

    That is great. Win7 on a small 64GB SSD drive and 8 Gigs of RAM. 6,9 Gigs more space now on the HD! Thanks a lot, man!

    Reply
  5. Alexander Tulchinsky

    Thank you very, very much.
    Indeed, why “make it better”, that was fine and simple in WinXP with “hibernate” uncheck option?

    Reply
  6. Asgeir

    Sweet, saved me 4,5 GB :D
    Thank you!

    I disabled the pagefile on C: also, enabled in on the ordinary HD if for some reason my 6GB should run out.

    (INSANE that the file isn’t removed like in winxp)

    Reply
  7. Hamish

    Thanks man! my SSD was running out of high performance disk fast.. that hiber file really need to go… worked a treat… I just pressed Windows Key + R, and pasted that line “powercfg -h off” pressed enter.. viola, hiberfile gone.. sweeeet!!!!

    Reply

Leave a Reply