hiberfil.sys Windows Delete to Free Up SSD Space
This article provides a tutorial on deleting the Windows hibernation file (hiberfil.sys). This is useful in order to recover disk space when a small solid state disk (SSD) is used as the system drive. A full disk can prevent Windows from updating and can cause programs to crash and the computer to run slow. Another use for removing hiberfil.sys is to reduce the disk image size for a virtualised test PC or cloud based machine, such as a Virtual Private Server (VPS).
Disable Hibernation on Windows to Remove hiberfil.sys for More Disk Space
Please ensure you have a backup of any data and files you need to keep before changing system configurations. This article is for information only. System configurations can vary widely, therefore any changes made are at your own risk. If you're confident with computers and understand the meaning of the hiberfil.sys file you can skip to the end of the article for the relevant command, which is to run powercfg -h off
at the administrator's command prompt, otherwise read on for a better understanding.
Background
Apart from the very low end systems, a SSD drive is standard fitting to computers and laptops. An SSD is also a common upgrade to older systems. A SSD costs more per gigabyte (GB) than a mechanical hard disk drive, as a result small capacity SSDs (128 GB or less) may be used to keep costs down, especially in tablet devices. The Windows operating systems (OS) requires 20GB for installation, and modern computing demands soon eats into the the remaining space on the small SSDs.
One way to overcome small SSD limitations is configure a system to use the small SSD for Windows and a large multi-terabyte hard drive for data storage (see Move My Documents and Other Personal Folders). Despite this, or if a second drive is not an option, the SSD may fill up quickly with normal use. Once the SSD is full the computer or laptop will not function properly, may not boot up, or show error messages at boot time. The worst case scenario is data corruption and loss, or even disk failure, when applications cannot handle running with no disk space available.
Shut Down, Sleeping and Hibernating
The power status of a Windows computer can be in one of several states, depending upon the computer type (e.g. laptop or desktop), the configured Power Options, and version of Windows:
- Powered on ready for use
- Shut down (powered off)
- Sleeping (screen off, CPU running slower, fans off, hard disks not spinning)
- Hibernating (memory contents written to disk and PC powered off)
- Hybrid Sleep (as for sleeping, but memory written to disk like hibernating, this stops data loss for when a PC is sleeping but losses power)
Options 3, 4 and 5 are used for power saving and faster Windows restarting (see also the Microsoft article Shut down, sleep, or hibernate your PC).
What is hiberfil.sys?
For options 4 and 5, when Windows has hibernated, if the system loses total power, from a power cut or when a laptop battery dies, Windows can still restart the last session when power is reapplied. However, this requires the computer's memory to be stored on the disk in a Windows system file called hiberfil.sys. The hiberfil.sys is stored on the system root (C:\hiberfil.sys). If the computer has 8 GB of memory it requires a similar size file. Commonly computers are fitted with 4GB to 16GB of memory. Therefore, a multi-gigabyte hiberfil.sys would take a large chunk of SSD space.
The C:\hiberfil.sys Windows File
Since hiberfil.sys is as large as the system memory turning off hibernation can free up a lot of disk space. The following picture shows how much space a hiberfil.sys is taking up on a Windows machine with 16GB of memory and a 60GB SSD system disk. The utility used is WinDirStat. Hiberfile.sys is the biggest file by far!
To delete the hyperfil.sys Windows system file hibernation must be disabled. Disabling hibernation has some considerations. The Power Options must be configured so that the machine is always left in a safe state when not being used. The safest state is to always Shut down the machine.
Access the Power Options from Control Panel. This can be done in several ways. Note that you will need administrator access to be able to do this:
- Click on the Windows flag on the Task Bar, select the Settings (gear) icon, select Power & sleep and then Additional power settings.
- Alternatively bring up the context menu (usually right click) on the Windows flag on the Task Bar, select Power Options. In Power & sleep select Additional power settings.
- Or type Power at the Start screen and again select select Power & sleep and then Additional power settings (or simply Power Options in some Windows versions).
In Power Options for the selected plan select Change plan settings. Then select Change advanced plan settings. Under Sleep if HIbernate is available ensure it is set to Never (there may be more than one Hibernate option, e.g. for laptops). If the option contains a value, e.g. 60 minutes, deleting the value sets it to Never. Also ensure none of the options under Power buttons and lid are set to Hibernate.
Use powercfg.exe to Delete hiberfil.sys
Open up a command prompt with administrator privileges. To do this type command at the Start screen. Bring up the context menu on Command Prompt (usually right click), then select Run as administrator.
Use dir c:\ /ah
to list hiberfile.sys in the root directory.
In the command window type the command to delete hiberfil.sys:
powercfg.exe -h off
If required use dir c:\ /ah
again to see that hiberfile.sys is no longer present.
The WinDirStat program visually shows the difference from the previous image:
After making the necessary changes check that the normal Sleep and Shut Down options are working as expected. Tweak Power Options if required.
If hibernation is required in the future reverse the instructions above (using powercfg.exe -h on
).
Related Articles
Free Up Disk Space on Windows with a Disk Cleanup
See Also
- For a full list of all the articles in Tek Eye see the full site Index.
Archived Comments
Ivan on May 9, 2015 at 3:16 pm said:
What a RIDICULOUSLY long winded bloated article just to need: \type powercfg -h off\ in command prompt.
Geez
Tek Eye on May 10, 2015 at 11:09 am said:
Thank you for reading the post and finding the information your needed. It’s not that long for an "article", a lot of it is images. As an article it provides background information for those who are not familiar with the the more technical aspects of their computer and may be interested to learn some details. This gives them confidence deleting the hiberfil.sys system file and fully understanding the implications, especially novice laptop users. For those who are more experienced I’ve summarised the relevant command in the first paragraph.
Brad on June 21, 2015 at 10:39 pm said:
I actually thought it was very short for a technical article. Very good article and thank you for posting. By looking at this persons picture, they’re clearly not the most intelligent person around.
Jack on September 2, 2015 at 6:53 am said:
I was looking for how to check if hiberation mode is actually off because it won’t say anything in the cmd after you input that command. This article is the only one I found that shows dir c:\ /ah command to check if hib is still using your storage space. So I thought that was a nice addition.
Richie on September 27, 2015 at 7:04 pm said:
Thanks for the help! It is appreciated, and thanks for going into so much detail!
Ignore messages like that.
Don R. on May 29, 2017 at 5:55 pm said:
What an ungrateful jerk. No one forced you to read the article.
Don R. on May 29, 2017 at 5:56 pm said:
Oh yeah – thanks Tek Eye for the Article.
Ed on May 23, 2015 at 3:50 pm said:
Great article. Yes it was long but you explained everything in detail which was excellent.
Udegbunam Chukwudi on June 28, 2015 at 5:24 pm said:
@Tek_Eye: You’re so nice. Ivan’s comment would never see the light of day if this were my website and if it did, I’d make sure to give him a good piece of my mind.
Anyway, thanks a million for saving me the hassle of deleting and setting up a larger windows partition on my macbook (How To Resize Your Macbook’s Partition Without Losing Data). You’re freaking amazing. hugs
Tinker-Bella on August 5, 2015 at 3:03 pm said:
Thank you. I had the command previously but it didn’t work. Probably because I hadn’t turned off hibernation in the control panel. After removing the file I gained 30 gb of space and saved a lot of money by not having to replace the drive with a larger one.
Suhail Sadiq on August 7, 2015 at 12:01 am said:
You are awesome. Thanks a lot for taking the time to help others out. God Bless You!
Gregg Geigler on August 10, 2015 at 3:28 pm said:
Your article addressed my problem exactly (Win8.1 tablet with small SSD) where I wanted to remove Hiberfil.sys. Thank-you!
Gregg Geigler on August 10, 2015 at 3:29 pm said:
Thanks, your article was exactly what I was looking for.
Samiran on September 24, 2015 at 7:19 am said:
Thank U Sir. A really nice article. Solved my problem, because my c: drive was getting filled everyday.
Andrew Corbett on May 29, 2016 at 6:23 am said:
Hi Daniel,
I’m late to the party but wanted to thank you very much for your very clear explanation. I’ve just deleted the hibernation file and regained 12GB for my hard drive. I wouldn’t have been game without your step-by-step instructions.
Oh, and a quiet word to Ivan – clearly you’re an expert but I felt your comment was unnecessarily tactless.
Tim on October 18, 2016 at 3:06 pm said:
What a RIDICULOUSLY asinine comment to make about a very well thought out and thorough post, with screenshots to boot. I appreciate someone doing a good job at providing clarity to even simple subject matter... Hey Tek Eye – good job and keep it up... Hey Ivan – quit being an asshat!
Marco on July 21, 2017 at 10:21 am said:
Thanks for the article.
Author:Daniel S. Fowler Published: Updated: