How to Make Hibernation Work Better on Your PC

Many of us hibernate our PCs instead of turning them off. This provides a quick way to restart while using less power than the “Sleep” mode. This is particularly useful in laptops. Hibernation works by placing  the contents of RAM in a hidden system file called “hiberfil.sys”. In Windows XP and Vista, this file is the same size as the amount of RAM that is installed on the PC. In Windows 7, the default is 75% of the RAM size. This file is always in the root of the drive with the Windows folder or normally the C: drive.

Deleting and restoring hiberfil.sys

It has become common to have a rather small volume for the C: system drive. It has also become common to have 4GB or more of RAM. This means that hiberfil.sys can take up a substantial portion of your system drive. If drive space becomes critical, you may wish to delete the hiberfil.sys file and turn off hibernation. Because hiberfil.sys is a super-hidden system file, the usual way to delete a file does not apply. However, there is a very simple way that uses the command line run as administrator.

Open a command prompt run as administrator and enter
    powercfg –h off

That’s all there is to it. To restore the file enter
    powercfg –h on

These changes take place right away

The command-line method is also useful for dealing with a corrupt or badly fragmented hiberfil.sys file. In the process of going in and out of hibernation many times, the file sometimes becomes corrupted. Deleting the file and then restoring it will clean up the file.

Changing the size of hiberfil.sys

If you wish to retain hibernation but want to reduce the size of hiberfil.sys, that can also be done in the command line.  The file can be reduced to a smaller percentage of RAM with the command "powercfg –h -size <percent size>”. The command must be run as administrator. For example, to reduce hiberfil.sys to 50% of installed RAM, use
    powercfg –h -size 50

Percent size cannot be smaller than 50.

Get your own favorite tip published!  Know a neat tech tip or trick?  Then why not have it published here and receive full credit?  Click here to tell us your tip.


This tips section is maintained by Vic Laurie. Vic runs several websites with Windows how-to's and tutorials, including  a computer education website and a site for learning about the command line.

Click here for more items like this. Better still, get Tech Tips delivered via your RSS feeder or alternatively, have the RSS feed sent as email direct to your in-box.

Share this
3.73913
Average: 3.7 (23 votes)
Your rating: None

Comments

by dkp93 on 20. October 2013 - 14:41  (111610)

powercfg -hibernate off
or
powercfg -hibernate -size 50

I kept getting an error "Permission Denied" although I am logged in as administrator. I created a text file with the command I wanted and included a pause to see the results. And renamed the file extension to .bat.

I copied the file in windows\system32 folder and then right clicked to run it as administrator.
Walla

The file ran and the hybersys file was reduced to 50

The steps are create a text file on your desktop.

write or paste the command you want.
I used :

powercfg -hibernate -size 50
pause

Then save and rename the file extension to .bat

copy it to windows\system32 folder and run it as administrator.
Hope this helps a few who are stuck like me with the error that you need to login as admin although you are the admin.

by v.laurie on 20. October 2013 - 14:55  (111611)

Being just logged in as administrator isn't sufficient. You have to also specifically run the command line as administrator.

by Ljay (not verified) on 27. February 2012 - 21:27  (89606)

I am running Win 7 64 bit . "Run as Administrator" even though I am logged on as Admin I still have to right click on the "Command Prompt" Icon in Accessories and select from the drop down menu "Run as Administrator"
Then this tip worked for me with /h /H or /hibernate
Hope this helps any who are having trouble with
Administrator Privileges

by Aguy (not verified) on 26. February 2012 - 1:48  (89499)

Windows 7 Pro x64

-h does not work

/h works

Thanks for the tip.

by JEB (not verified) on 25. February 2012 - 13:42  (89459)

I created a shortcut for each of these commands so I can 'clean up' easily about once a week.

by crank on 25. February 2012 - 1:28  (89417)

I have never had a desktop that hibernated successfully, or even slept with better than 50% chance of waking up without a fatal hangover. This is across 5 or so PCs, my two laptops do fine. Am I doing something wrong? I haven't ever adjusted anything, just tried sleeping/hibernating automatically. So I've always gotten rid of that file, it wasn't of any use.

by sludgehound (not verified) on 24. February 2012 - 19:38  (89397)

powercfg –h off had to use powercfg –H off

On Windows 7 x64 using -h just got the msg about not finding the command. Using the help /? shows it has capital -H on:off so tried that. Happens in a flash, no msg so guess it took since returned to command line in user folder of command prompt run as Admin.

by Karl K (not verified) on 25. February 2012 - 14:01  (89460)

I tried this tip with both lower case "h" and upper case "H" and neither one worked on my floortop computer (Win7 Ultimate X64).

My laptop, with Win7 Home Premium X64, hibernates just fine right-out-of-the-box!

I'm stumped! (I've also resigned myself to "Sleep" mode on my floortop, although that's seldom necessary since it's on-line 24/7)

Karl

by v.laurie on 24. February 2012 - 19:46  (89398)

On Windows 7 x64 using -h works just fine for me. It is rare that a command is case sensitive.

by unsteadyken on 24. February 2012 - 19:12  (89393)

I find that my Vista laptop requires the full hibernate command
powercfg /hibernate on
-h doesn't work here:

by AnonymousLee H (not verified) on 24. February 2012 - 15:42  (89372)

You may need to run the cmd prompt as administrator.

by v.laurie on 24. February 2012 - 14:39  (89369)

It should be noted that not all systems support hibernation. This is particularly true of desktops and older machines.

by Roberteh (not verified) on 24. February 2012 - 17:43  (89389)

Oh, it should be noted.....thanks?

by Roberteh (not verified) on 24. February 2012 - 14:33  (89367)

Once done how do you know if you are successful or even if the effort has made any difference. The brief moment the black input screen pops up is little indication. The powercfg/?....does the same, the black screen appears and is gone in a second. I even ventured through the "super hidden" link on this page where the command there (dir C:\ /as) renders an error result "dir" cannot be found etc. I am running XP Pro and it would great to see what you've suggested is actually taking place and to be able to see the difference.

by Dave Pyatt (not verified) on 24. February 2012 - 15:17  (89371)

Bring up a command windows (cmd) and then initiate the command. You may want to pipe the output through the MORE filter, especially if you list the help (powercfg /?|MORE)

by v.laurie on 24. February 2012 - 14:23  (89366)

I get the impression that some people may have confused running a program as administrator with being logged into an administrator account. Being in an administrator account is not sufficient. See this previous tip- http://www.techsupportalert.com/content/quick-ways-open-windows-vista7-c...

by Anonymous Scheister (not verified) on 24. February 2012 - 13:44  (89359)

By turning of the hibernation file how much space do you gain on your hardrive?

by v.laurie on 24. February 2012 - 14:42  (89370)

As explained in the tip, it is a function of how much RAM you have.

by Kubo (not verified) on 24. February 2012 - 13:40  (89358)

Doesn't work with me. Required "/?" always.

by Kubo (not verified) on 24. February 2012 - 21:47  (89406)

@ unsteadyken, thanks for your tip. It works now:

powercfg -hibernate off

by knookie on 24. February 2012 - 12:11  (89354)

Win7

I had a need to do this a while back and after entering powercfg –h on i still couldn't see the hibernate option so i had to go in to Power Options in the control panel click on the link “Change when the computer sleeps” and then open the link “Change advanced power settings” then Under the Advanced Sleep options, expand the Sleep tree and turn off Allow hybrid sleep.

showed up after that

by Karl K (not verified) on 24. February 2012 - 13:54  (89361)

I tried the article's tip on my Win7 Ultimate X64 opsys, and it didn't work either (I was logged in as Admin, too!). I then tried Knookie's tip (above) and I STILL can't get the "Hibernate" option to show up in my Shutdown options!

Am I missing something? (Probably) Any further guidance or suggestions?

Karl

by Kubo (not verified) on 24. February 2012 - 22:17  (89410)

Hi Karl K, try 'unsteadyken' tip [Post (89393)]. It worked to me.
powercfg -hibernate off
powercfg -hibernate on

by Karl K (not verified) on 24. February 2012 - 23:52  (89413)

Many thanks, Kubo. I will try that. I tried the ALL CAPS tip, but that didn't help at all.

Karl

by AlanWade (not verified) on 24. February 2012 - 12:05  (89353)

@ glofp-dk
Same with my system, you must use capital letters for this to work.

by Karl K (not verified) on 24. February 2012 - 13:55  (89362)

Ah-ha! I'll try it again, but using ALL CAPS for the entry! I'll advise results shortly.

Karl

by Karl K (not verified) on 24. February 2012 - 14:04  (89363)

NOPE! I logged in as Administrator (as in the original tip) and then entered the change in ALL CAPS.

The "Hibernate" option STILL doesn't show up in my Win7 Ultimate X64 system!

Karl

by glofp-dk (not verified) on 24. February 2012 - 10:49  (89350)

I tryed setting the powercfg on/off, but on my PC it only works witk capital letters - this is also described in the /? help file in command prompt

by r2mahara (not verified) on 24. February 2012 - 10:37  (89349)

Does the size trick only work on Windows 7?

by eikelein on 24. February 2012 - 11:54  (89352)

r2,
You can test that easily by opening the command prompt and running
powercfg /?

There are SIGNIFICANT differences between what it shows in Win7 and in my (virtual!) XP.

Gizmo's Freeware is Recruiting!

Gizmos Needs YouShare your knowledge of free software with millions of Gizmo's readers by joining our editing team.  Details here.