How to delete hiberfil.sys on Windows 2008 or Vista

I was (for my sins) working on a Windows Server 2008 box today. To make it worse it was a VM with very little disk space. In trying to find things to remove I found hiberfil.sys sitting there at 4Gb! I tried to delete it but Windows wouldn’t let me. I then went into power settings, disabled hibernation (or so I thought) and tried to delete it again… still no joy.

Anyway, it turns out the easiest (or only, I don’t know) way of deleting this stupid file (why Windows SERVER would need to hibernate anyway is beyond me!) is to drop into command prompt and run the following command:

powercfg -h off

Easy when you know how, but annoying if you don’t!

13 replies
  1. fishing organizations
    fishing organizations says:

    Thanks so much. I, too saw this stupid file, and, after trying almost every I knew, finally gave up and just accepted that I had lost all that wonderful space.

    Your post gave me the answer. You’re a genius.

    Reply
  2. beth charette
    beth charette says:

    WOW, I would never have found that.

    It is always amazing to me how difficult it is for programmers to see all the ramifications of programming decisions they make or don’t make.

    Windows of course has no ONE person who can see everything, consider everything as a whole.

    Working as a programmer myself, we have broken our system up into so many parts, with so many people each having a special function that even humpty dumpty would not be able to fully appreciate the potential for unintended consequences regarding any one change.

    Reply
  3. Pexx
    Pexx says:

    Well, this doesn’t work on all servers. I have eight machines with windows 2008 standard, and was able to remove hiberfil.sys on seven of them. On the last server nothing happens when I try powercfg -h off. The file is still there.

    Reply
  4. Pimax
    Pimax says:

    Nothing happened.. 🙁 The system (Win7Pro 64bit) said that “no permission to On or Off hibernation mode…”

    Why? I’m the only user on system and have admin rights..

    Reply
  5. Ed
    Ed says:

    Note that if you have Hibernation enabled and then install the Hyper-V role, the solution above will not work. Instead, you will get an error “A internal system component has disabled hibernation” when you try to run “powercfg.exe -h off”. This is because the Hyper-V role disables hiberation – you can’t turn it off or on using powercfg.exe. To work around this problem, remove the Hyper-V role using server manager. Then, “powercfg.exe -h off” WILL work. After that, you should be able to reinstall the Hyper-V role. I don’t know whether or not this is destructive to any virtual machines that you have configured.

    Reply
  6. Chronoslip
    Chronoslip says:

    Dear Ed,

    THANK YOU! I was running out of disk space on a 2008 R2 server and tried everything to get rid of that file. Nothing worked (including stopping all Hyper-V VMs and all Hyper-V services) until I uninstalled Hyper-V. Just got 16GB of space back. You rock!

    Reply
  7. NAMTAH
    NAMTAH says:

    With your help, I just removed an 8 GB hiberfil.sys file from a VM 2008 server (I too have sinned) and I noticed that someone had moved the pagefile to D from C at some point in the past. Pagefile.sys and the hiberfil.sys file had the same time/date properties. I wonder if when you move the pagefile, Windows creates the hiberfil.sys for some reason. Either way, thanks much!

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *