Microsoft

How do I delete hiberfil.sys and reclaim the hard disk space?

The Hibernate feature in Microsoft Windows creates a hiberfil.sys file. Here is how you delete that file and reclaim the hard disk memory.
Editor's note: If you have ever used the Hibernate feature in Microsoft Windows, then you have created the hiberfil.sys file in the system root directory. If you use Hibernate all the time, this is how it is supposed to be, but if you do not use Hibernate, you can reclaim some hard disk memory space by deleting the file and turning off Hibernate. TechRepublic's Head Technology Editor, Bill Detwiler, is going to show us how.

This How do I blog post was adapted from a post in the TR Dojo Blog and is available in PDF format in a free TechRepublic download.

Hiberfil.sys and Windows Hibernate function

To understand why hiberfil.sys exists, we must look at the Windows Hibernate function. When you activate Hibernate, Windows takes a snapshot of your current session (all your running programs, open files, etc.) and writes that information to your hard drive. Hibernate was designed to speed up shutdowns and restarts and save power on laptops.

Figure A

Windows hiberfil.sys
Hiberfil.sys, as the name suggests, is the file to which Windows saves the snap-shot data. Thus, the file is always equal in size to the total amount of available RAM on the computer (Figure A). On a computer with plenty of free disk space, having such a large file just hanging around usually isn't a problem. But if you're running low on hard drive space and never use the Hibernate feature, hiberfil.sys is unnecessarily eating up valuable disk real estate.

Disabling Windows Hibernation

As I noted earlier, you can manually delete hiberfil.sys, but it will just come back. To permanently remove the file, you must disable the Windows Hibernate function. You can do this through either the Windows GUI or the command line.

Windows XP

On Windows XP systems, you can easily disable Hibernate through the GUI using the following steps:

  1. Open the Control Panel and access Power Options.
  2. Select the Hibernate tab in the Power Options Properties dialog box.
  3. Clear the Enable Hibernation check box (Figure B) and click OK.

Figure B

Windows XP - Power Options - Hibernate

If you would prefer to disable Hibernate through the command line, you can use the steps outlined below.

Windows Vista and Windows 7

Completely disabling Hibernate through the GUI on Windows Vista and Windows 7 is significantly more difficult than on Windows XP. The Hibernate settings are still stored under the Control Panel's Power Options applet, but they are buried under each power plan's advanced power settings submenu. In fact, I was unable to remove hiberfil.sys by altering the appropriate Power Options (Allow Hybrid Sleep and Hibernate After) on either Windows Vista or Windows 7 (Figure C).

Figure C

Windows 7 Power Options - Advanced Settings - Sleep and Hibernate

The only surefire method of disabling Hibernate, and thus removing hiberfil.sys, on Windows Vista and Windows 7, is through the command prompt and the following steps:

  1. Open a command prompt with administrative privileges.
  2. Enter "powercfg.exe -h off" (Figure D).
  3. Exit the command prompt.

Figure D

Windows powercfg.exe

As soon as you clear the check box or execute the above powercfg.exe command, Windows should delete hiberfil.sys. If not, you can manually delete it.

Re-enabling Windows Hibernate

To turn the Hibernate function back on, simply recheck the Enable Hibernation setting under Power Option Properties or enter "powercfg.exe -h on" at a command prompt with administrative privileges.

TechRepublic's Windows Vista and Windows 7 Report newsletter, delivered every Friday, offers tips, news, and scuttlebutt on Vista and Windows 7, including a look at new features in the latest version of the Windows OS. Automatically sign up today!

About

Bill Detwiler is Managing Editor of TechRepublic and Tech Pro Research and the host of Cracking Open, CNET and TechRepublic's popular online show. Prior to joining TechRepublic in 2000, Bill was an IT manager, database administrator, and desktop supp...

Editor's Picks