Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Windows 7 running on a small (40GB) partition, with 4GB ram. This means that the hiberfil.sys file created by Hibernate takes up a significant portion of the available diskspace. I would like to remove it.

I am aware that I can disable Hibernate and remove hiberfil.sys by entering powercfg -h off in an elevated command prompt. This works -- the file is immediately removed, and after doing so, the HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\HibernateEnabled key is (correctly) set to 0.

However, the next time I reboot the PC, hiberfil.sys returns from the dead, Hibernate is reenabled, and that registry key has returned to 1.

I'm pretty much at my wits' end with this. Almost everything I can find online related to removing the hiberfil.sys file simply suggests using powercfg to turn off hibernation, and that appears to work for just about everyone. But it just keeps coming back for me! (Like a vampire, sucking up my disk space.) I did find one other thread from someone who seems to have had the same issue, but none of the suggestions there worked for the original poster (or for me). Still, I have tried everything listed there, including:

  • Disabling hybrid sleep

  • Disabling Hibernate through the command prompt, through the Power Options GUI, and through both (in both orders)

  • Manually changing the HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\HibernateEnabled key

  • Pretty much everything else I can think of!

I do want to reiterate that I have no problem removing the file -- that works great. It just comes back after every reboot. I'm about ready to throw in the towel and just run a script on login to disable Hibernate each time, even though that seems like a crazily hacky "solution" . . . but I was hoping someone here could suggest something else, first.

share|improve this question
    
You must have some security software monitoring and protecting the registry. –  Moab Dec 5 '10 at 3:08
    
Given how long this question has been sitting there, and since this might be a prevalent issue, I have put a bounty on this question. –  DragonLord Apr 9 '11 at 1:30
    
You don't happen to have custom boot software installed that would do this, would you? –  Mehrdad Apr 9 '11 at 1:59

11 Answers 11

My Windows 7x64 install is on an SSD partition on a Mac laptop. I've disabled with powercfg /h off (elevated) and ms fixit's disable hibernate, as well as the setting registry key HibernateEnable value to 0. Hiberfil.sys is deleted only until reboot. When I boot native hiberfil.sys is always re-created, but when I boot inside OS X and VMware Fusion, the hibernation stays disabled, as it should.

Tom Wijsman's suggestion of ProcessMonitor with boot logging helped me find that vmtoolsd.exe (from VMware) was re-enabling the registry key during the native boot. I tried to change the permissions in regedit, but they did not stop the value change to 1. I thought about creating a small hiberfil.sys, but I think that would ave been overwritten.

As a 99% solution, I changed the HiberFileSizePercent value to decimal 1, which makes the hiberfil.sys only 80MB on an 8GB RAM machine. I suppose I could try .001 or less, but 80MB is not much.

share|improve this answer
1  
Thank you - I'm on a Macbook with Bootcamp and VMWare Fusion too, you probably saved me hours. –  DanB Mar 13 '12 at 11:46

You can easily troubleshoot this with Process Monitor.

Start it and enable Boot Logging in the Options menu, restart your computer and start Process Monitor.

Then, let it stop capturing and then search for HibernateEnabled and check what changed the value.


For more advanced insights, this can also be done with XBootMgr from the Windows Performance Toolkit.

Installation Instructions - On/Off Transition Performance Analysis Document

share|improve this answer
1  
+1 xbootmgr.... –  Moab Apr 8 '11 at 22:54
1  
As your answer has the most potential for solving the problem, I have decided to award the bounty to you. –  DragonLord Apr 12 '11 at 15:05

If you're using boot camp and vmware fusion:

Find the file %programfiles%\VMware\VMware Tools\plugins\vmsvc\disableGuestHibernate.dll delete it or move it.

Finally, disable hibernation once and for all by opening an administrator elevated command prompts and running:

powercfg -h off

The disableGuestHibernate plugin loads when vmware tools loads. If vmware tools loads while running in a vm, it will disable hibernation (since vmware has its own suspend system making hibernation redundant.) But if vmware tools loads outside of a vm (i.e. you use boot camp to boot into windows instead) it will re-enable hibernation if its disabled.

share|improve this answer
    
This is a great answer and well detailed. If I could give it 10 upvotes, I would! –  Rijk Apr 16 '13 at 17:06
    
By the way: simply renaming it does not work, you really have to remove the dll. –  Rijk Apr 16 '13 at 17:13
    
This fixed it for me as well. Upvote! –  MortenRøgenes Nov 14 at 8:48

You could try to turn hibernate on and off again. In cmd "Run as Administrator" do :

powercfg.exe /hibernate on
powercfg.exe /hibernate off
del c:\hiberfil.sys

If you are using a laptop, then after turning hibernate on and before turning it off, do also the following :

  1. Ensure that hybrid sleep is disabled.
  2. Power Options → Change plan settings → Change advanced power settings, expand Sleep and change the value of "On battery" and "Plugged in" to 0 minutes.

image

share|improve this answer

same thing here!

out of frustration, I even configured the local policy such that it would run a cmd on machine startup that would run the powercfg line, but even that's not good enough!

this is really frustrating since I'm running Win7 Ultimate on a 60 GB partition.

in my next experiment I shall toy with the "HiberFileSizePercent" registry key under:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power

and see if that might force it to (re-)create a smaller file at least.

f.

share|improve this answer
    
+1 - This is probably a good idea. I have come across this same solution while helping another user with his unrelated hibernations issues. –  SgtOJ Dec 5 '10 at 2:09
    
I never did end up solving this. I ran a login script for a while, but it was flaky, and eventually I just ended up buying a bigger drive and leaving the hiberfil.sys file in place. I wish you the best of luck, and I'll follow this thread. If you are successful, please post back! –  Corey White Dec 5 '10 at 4:05
    
You could also delete hiberfil.sys after disabling hibernation, and then create a directory called hiberfil.sys. You can't have a file and a directory in the same directory with the same name, so Windows will not be able to create a file called hiberfil.sys. Of course, MS might have accounted for that and it might create another file (hiberfi2.sys?) or it might complain loudly about it. –  Bacon Bits Apr 9 '11 at 2:15
    
@BaconBits: biziclop said this doesn't work; Windows replaces the folder with the hiberfil.sys file. –  DragonLord Apr 9 '11 at 2:59

I had the same problem. Tried:

powercfg –H OFF

Set HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\HibernateEnabled

Set Control Panel\All Control Panel Items\Power Options\Edit Plan Settings for Never for all power options.

And the file kept coming back to life. The advice of using process monitor did the trick for me. The system I use has "Pointsec for PC" installed, and the prot_srv.exe process kept resetting this value. Given this PC is locked down with this software, there is not much I can do.

share|improve this answer

You can disable the hiberfil.sys file by disabling hibernate on your Windows computer. Learn how to disable hiberfil.sys and delete it permantely

share|improve this answer
1  
Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  slhck May 29 '12 at 19:34

Not a solution, but a workaround that worked for me:

I had only 900MB of free space on my C drive and wanted to get rid of the hiberfil.sys file, which took more than 6GB. So I removed it with powercfg -h. But it just kept coming back after about 10 seconds or something. I think it has something to do with PointSec because that was mentioned earlier here.

Then I disabled hibernation, and then quickly copied a 1GB file over to the C drive. Now it doesn't come back and I have still 6GB of space left. I guess it's still trying to enable hibernation and finds that there is no longer enough space for that. And next time I run out of space on the C drive, I can still delete the 1GB file..

share|improve this answer

Maybe manually recreate it after the removal and set permissions to disallow the system to modify the file? I know, it's a long shot.

Could this be caused by a restore partition or similar?

share|improve this answer

I have a workaround that seems to work just fine for me (though, maybe not everyone). From what I've gathered, vmtoolsd.exe disables hibernation when booting under VMware and then re-enables it (regardless of previous state) when booting natively. Since VMware Tools aren't necessary when running native (Boot Camp), I made a batch file containing the following:

@echo off

if "%NUMBER_OF_PROCESSORS%" == "1" goto :enable
goto :end

:enable
net start "VMware Tools"

:end

I set the VMware Tools service to Manual (rather than Automatic) and created a task in Task Scheduler. The task is set up as follows:

  • Run whether the user is logged in or not
  • Run with highest privileges
  • Hidden (may not be necessary)
  • Triggers: at system startup
  • Actions: the batch file above
  • Uncheck everything in Conditions/Settings (may not be necessary)

NOTE: since I rely on the NUMBER_OF_PROCESSORS to differ from when booted natively, this will only work if you do not have the virtual machine given the same number of processors (logical, not physical) on your Mac.

Also, the batch file can be simplified to:

@if "%NUMBER_OF_PROCESSORS%" == "1" net start "VMware Tools"

I had a few things in the batch file for debugging/testing and just kept it.

share|improve this answer

Half answer:

On Windows XP, this was an easy and permanent solution:

  1. delete hiberfil.sys with this command (with admin rights): powercfg -h off

  2. create a folder called "hiberfil.sys" at C:\

Unfortunately, Win7 is "smarter" than XP, and kills this folder, ignoring any ownership/permission combination I tried. But sometimes my hiberfil.sys folder survived a single restart without being replaced. It is also interesting that the system seemed to regenerate the original file after a few seconds the the window of C:\ appeared on the desktop.

And thank you for my first downvote :)

share|improve this answer
    
That might not be such a bad idea - you could set its permissions so that not even System could delete it (without first changing its permissions). Of course, win7 might simply refuse to boot. –  Hugh Allen Apr 9 '11 at 8:51
    
@Hugh: It's possible that the hibernation code, being part of the kernel, would just ignore ACLs. –  grawity Apr 9 '11 at 12:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.