Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I today discovered that we can set the size of the hiberfil.sys using powercfg -H -size 100% command line tool. Ignoring the hard space you will get, what else will change if we set it to powercfg -H -size 50%? Does it limit max RAM usage to 50%? Will system doesn't hibernate if I we more than 50% of RAM?

share|improve this question
the system will crash with this bucheck ( when the used RAM is larger than the hibernation file can store – magicandre1981 Apr 26 '14 at 14:38
up vote 14 down vote accepted

I have found a Microsoft document regarding the hibernation file. What it tells us is that the contents of memory are compressed before being dumped to the hibernation file so most of the time setting a lower percentage size of the hibernation file is beneficial as less disk space is wasted.

Windows supports hibernation by copying the contents of memory to disk. The system compresses memory contents before preserving them on the disk, which reduces the required disk space to less than the total amount of physical memory on the system.

The correct syntax for the command appears to be:

PowerCfg.exe /HIBERNATE /SIZE 75

The document also states that if the hibernation file is too small then a "Stop Error" will occur and the codes will suggest how much you need to increase the hibernation file size by.

Doing this will not limit the amount of physical RAM available to your system.

As it is compressed then reducing the size of the file will not be problematic if you only rarely hit 100% of physical memory used and/or your memory is likely to contain data that is reasonably compressible which most of the time it should be.

From that document:

Windows reserves disk space for hibernate in the hibernation file, which is named Hiberfil.sys. For Windows 7, the default size of the hibernation file is equal to 75 percent of the total physical memory on the system. For example, on a computer that has 2 GB of RAM, the default hibernation file size is 1.5 GB.

In rare and extreme cases of memory use, including memory validation by a memory performance or test utility, hibernate can fail because the contents of memory cannot be compressed enough to fit within the size of the hibernation file.

I would give it a try at lower numbers but personally I wouldn't go as low as 50%. It might well be fine though and the worst that will happen is that hibernation will fail and you'll have to reboot normally and set the size to be a bit larger.

share|improve this answer
Thanks for answer. I don't know about the official one but both powercfg -H -size 100% and PowerCfg.exe /HIBERNATE /SIZE 75 works properly – user218521 Apr 26 '14 at 14:58
It looks like on Windows 10, the powercfg command no longer accepts a /SIZE argument — it's no longer documented at least, but no error is produced if you specify it. – martineau Jan 17 at 16:15
I found the time for resuming from hibernation increased substantially when I lowered the percentage to 60% (Windows 7 SP1). Am I the only one? – deddebme Jan 24 at 2:10
@martineau it is entirely possible that due to the hybrid shutdown in Windows the size of the hibernation file has become adaptive in a similar fashion as the swap file. I've not had a chance to investigate, except to see that my hibernation file is approximately 35% of my system RAM size, but I'm not surprised. – Mokubai Jan 25 at 14:36
@deddebme: I haven't noticed any significant change on resume speed after using a powercfg -H -Size 60 size setting on my Win 7 Pro SP1. – martineau Jan 25 at 16:22

You must log in to answer this question.