One of my development machines has a dual-boot to a 2008R2 environment via the Boot from VHD technique. This works all quite well, but today I received the message the C-drive was getting a bit full. Most of the time this isn’t much of a problem, just delete some log files, do a disk cleanup, empty the recycle bin and maybe use SpaceMonger to see what’s using up the rest of the space. Also, most of the time there’s about 500MB left free on the disk.
Today was different. Visual Studio wasn’t able to build my solution due to insufficient free disk space on the C-drive. Upon further inspection I saw a total of 0 free bytes were available. After doing the regular cleanup I had a stunning 119MB free on my C-drive. SpaceMonger had already shown me there was a hibernate file on the C-drive which took up 8GB. Quite strange considering I had turned off all of my hibernate options in Windows (I really don’t like hibernating). Also, this hibernate file doesn’t get generated when booting the machine in VMWare Player or VMWare Workstation.
All of my internet sources say you have to run
powercfg -h off and reboot to completely remove the file. Problem with that is it gave (and still gives) me the following error:
An internal system component has disabled hibernation
After searching for a few hours on this subject I finally stumbled upon the weblog of Jian Sun.
The solution to the problem is to disable the hibernation via the registry. The hibernate options can be found in the following path:
Over here you can find the
HibernateEnabled keys. The blog of Jian Sun says you need to change the
HibernateEnabled from 1 to 0 to disable the hibernation (and reboot of course). This didn’t do the trick for me, so I started changing the
HiberFileSizePercent key. It was saying 100 when I started, but I’ve changed it to 2 now (so I don’t confuse it with a bit later on). After rebooting the filesize of hiberfil.sys was about 160MB. This really solved my disk space problem for now.
So, if you want to get rid of your hibernate file on the C-drive and aren’t able to get this working via the normal protocol, do some registry changes.