Our readers constantly ask us that Windows is taking up a lot of their disk space on the OS volume and that the free space is constantly reducing as they install updates and new apps. Previously, we covered some ways to get free disk space back by cleaning up the Windows Component Store on Windows 8.1/Windows 8 and Windows 7. We also showed how you can automate Disk Cleanup and run it directly in the system files mode. Today we would like to show you how you can free up disk space by enabling compression on your Windows hibernation file.
When hibernation is enabled in Windows, the OS creates a file called hiberfil.sys in the root of your C: Drive. This hiberfil.sys stores the contents of memory (RAM) when you hibernate your PC. When you resume from hibernation, Windows reads this file again and transfers its contents back to memory. Because memory capacities on modern PCs are always increasing, the hibernation file takes up considerable disk space.
Although you can disable hibernation and use sleep state or always keep your PC powered, it's not an energy-efficient way for mobile PCs. Also, features like Fast Startup in modern versions of Windows such as Windows 8/8.1 depend on hibernation being enabled to boot the OS faster. If you disable hibernation, you lose the benefits of fast boot.
To solve the problem of increasing RAM capacities, Microsoft added the ability to compress the hibernation file in Windows 7. This means that the C:\hiberfil.sys file does not take as much disk space as your RAM capacity. It can take significantly less disk space, even 50% of your installed RAM capacity. This is a fantastic improvement Microsoft has made in Windows 7 and later, but it's turned off by default. Let's see how to turn it on.
- Open an elevated command prompt.
- Type the following command:
powercfg hibernate size NN
where NN is the desired hiberfile.sys size in percentage of the total memory.
For example, if you have 8 GB of RAM installed and you want to set the hibernation file size to 60% to save disk space. Then simply use this command:powercfg hibernate size 60
This will set the hibernation file to 60% of 8 GB of RAM, meaning only 4.8 GB. It will save you 3.2 GB of disk space.
The size you specify cannot be smaller than 50, although if you hack around in the Registry, you can get a smaller size (highly not recommended).
Even if you have only 4 GB or 3 GB of RAM, setting this to 50% will save you 2 GB or 1.5 GB of disk space respectively. So this is a very cool optimization you can always make on every Windows system. You will have more free space on your C: drive than before.
If you have hibernation turned off, the powercfg hibernate size switch will automatically enable hibernation.
You can see the size of the C:\hiberfile.sys file in Explorer in gigabytes (GB) by selecting it or opening its Properties. Normally, this system file is hidden so you may need to turn on the setting to show hidden files as mentioned in step 2 of this article.
Note that depending on the quality of your RAM, your PC may fail to resume successfully if you set the hibernation file size too low such as 50%. In that case, if it fails to resume, set it to a slightly higher size such as 60% or 65%.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
This was a great tip, and I have implemented for my Win 7 Pro laptop.
But on my Win 7 Pro desktop, I do not use the hibernate state. My power is always on, although I do use a screen saver, and turn off the display after about 30 minutes of inactivity. Therefore, can I just delete hiberfil.sys? If so, do I do anything more sophisticated than just delete it from Windows Explorer?
Thanks. And thanks for all your great tips here and in Classic Shell.
Harry
Greetings Gaurav.
Well done on producing an easy to follow , extremely effective couple of articles helping to create much needed disc space on our overcrowded hard drives . I have a very simple little Hp stream-book 11 for all my mobile and lighter requirements . I’d done pretty well to keep it functioning and able to update with it’s 32 GB limitation for almost three years ( I only paid £117 Sterling for it) . Recently however being down to around 450 Mb of usable disc I had almost dug my wallet out of its worried slumber and accepted the need to either buy and create a USB boot or get a new portable unit altogether . Then This, and a couple of your other articles and what was lost, is simply not . Even on such a small hard-drive your easy to follow , simple and effective recommendations have gained me 4.8 GB and probably put that consumer commitment off by another year at least. so thank you enormously . There is so much sub par information on the internet especially in the tech sector and it’s positively refreshing to come across free and uncluttered expertise without all of the usual personality posturing and branding etc. I’m afraid I am unable to donate at the moment. I am however a long suffering professional writer of occasional aplomb and should you ever need help with anything along such lines, then please drop me a note . I’d like to be able to return the favor.
Thanks again
Pete