How to fix hibernation file issues in Windows 7

Home > Blogs > Windows 7 > How to fix hibernation file issues in Windows 7

How to fix hibernation file issues in Windows 7

Like This Blog 2 Steve Fullmer
Added by October 19, 2012

With the advent of advanced power settings in Windows 7, the Windows hibernation file (hiberfil.sys) is more commonly present on the hard drives of both mobile and desktop devices. Whether you are protecting yourself from loss of battery power, accidental contact with the power switch, or a power blackout, hibernation mode is designed to save your work. I actually find the use of hibernation mode to be extremely useful on my desktop. All my active work is saved, and should we lose power during monsoon season, recovery and return to work is very fast and efficient. If you have sufficient drive space, and a processor capable of supporting Windows 7, you should not see a noticeable performance hit.

The hibernation file, when present, requires disk space equivalent to the size of installed RAM.  On a system with 4 GB installed RAM, the hibernation file would use 4GB of storage space at the root of the boot drive. In Windows 7, Microsoft provides options for relocating the virtual memory file (pagefile.sys), to an alternate hard drive or to a solid state drive using ReadyBoost™. Not so the hibernation file. As a component of the boot sequence, the hibernation file must remain at the root of the boot drive if it is present.

I discuss drive space planning in a separate blog. Windows 7 Disk Usage Planning – Guidelines for better storage requirements. This entry discusses hiberfil.sys in more detail, and highlights a few approaches to the resolution of common issues. If you are going to use hibernation mode with Windows 7, you need to know how to recover disk space once you disable the setting, and to recover from some of the boot problems that might arise.

If you enable either hibernation mode or hybrid sleep mode, hiberfil.sys will be created automatically by the system. Hibernation mode power settings results in regular updates to hiberfil.sys so that it represents the memory state when power is lost. Hybrid sleep mode diminishes power to the system components identified in power settings, and effectively does not update hiberfil.sys until the battery power diminishes below a configurable threshold. In either case, hiberfil.sys will be created on the system drive as soon as the power setting is enabled. Using the control panel interface to disable hibernation mode does not result in deletion of hiberfil.sys. Therefore, once you have enabled hibernation mode through the control panel, you have dedicated the space whether hibernation mode is further enabled or not. Turning on hibernation mode also creates registry and boot settings. Hiberfil.sys is a hidden system file, requiring you to unhide and unprotect it before manual deletion, although this will not affect any registry or boot settings.

So, how should you remove the file if you want to recover space after disabling hibernation mode? Use the command line tool instead of the control panel interface. The powercfg command line tool automatically deletes the hibernation file when the setting is disabled, as well as properly configuring registry and boot settings. In fact, use of the command line tool to remove the hibernation file is recommended in several boot recovery scenarios.

To enable or disable hibernation mode from the command line, use to following command sequences. Note that it is essential to run the command prompt as an administrator or the changes will not occur as desired.

1. Click Start, and then type cmd in the Start Search box.
2. In the search results list, right-click Command Prompt, and then click Run as Administrator.
3. If you are prompted by User Account Control, click Continue.
4. At the command prompt, use powercfg.exe to change hibernation settings

a) You may use powercfg.exe or powercfg, either is interpreted correctly.
b) Hibernation mode is affected with the /hibernation, /h, or –h switches. Each form of switch is recognized.
c) To turn hibernation mode on, add on.  To turn hibernation off, use off.
d) An example to enable hibernation mode is powercfg /hibernation on
e) An example to disable hibernation mode is powercfg.exe –h off

powerfg windows 7 hibernation file issue

5. To confirm successfully enabling hibernation mode, you can type attrib h*.*  at the root of the boot drive to look for the instance of hiberfil.sys. To confirm that hibernation mode is disabled, once again use attrib h*.*  at the root of the boot drive (e.g. C:\) and you should not see an instance of hiberfil.sys.

hiberfil attrib win 7 hibernation file issue

6. Type exit and then press ENTER to close the Command Prompt window.

Remember, disabling hibernation mode via control panel power settings does not remove the hibernation file, it merely disables the setting. If you want to recover the disk space, then you must use the command line tool.

Hiberfil.sys, if present, is a part of the Windows 7 boot sequence. A good overview of the boot files sequence is available Windows 7, vista boot sequence, startup process, how they boot? If  hibernation mode is set, in addition to the creation of the hibernation file, a change is made to the boot control database. Rather than calling winload.exe to load the operating system, winresume.exe is called and loads hiberfil.sys directly to memory.

The following is a screenshot of a boot control database.

boot control database windows 7 hibernation file issue

A detailed look at the boot control database would reveal an entry for resume from hibernate that matched the GUID of the resumeobject from the above control database. It might look like:

Resume from Hibernate
identifier {2add1d2b-5d0b-11de-8f35-e41b2486f16a}
device partition=C:
path \Windows\system32\winresume.exe
description Windows Resume Application
local en-US
inherit {1afa9c49-16ab-4a5c-901b-212802da9460}
filedevice partition=C:
filepath \hiberfil.sys

If hiberfil.sys is present, then winresume.exe is invoked rather than winload.exe.

If the hibernation file is present, but corrupted, the system may hang during the boot process. Correction alternatives require using the F8 key to enter the recovery environment for Windows 7 or booting from alternate media. Once into a command line interface, hiberfil.sys needs to be removed from the root of the boot drive so that winload.exe is invoked. In this instance, it may be necessary to manually remove hiberfil.sys, but try powercfg first.

Alternately, the boot control database may be attempting to use winresume.exe although there is no hibernation file. Once in the recovery environment, the boot control database will need to be repaired using BCDEdit. Technet provides instructions for editing the Boot control database using BCDEdit. Note particularly the community content at the end of the Technet article that walks through the emergency process of repairing the boot control database if it is damaged.

How do you know if you have a missing or corrupted hibernation file? The Windows boot error status 0xc00000e9 indicates that BIOS or EFI is unable to properly communicate with the hard drive to find a necessary boot process file. This might occur due to missing or damaged boot control database, winload.exe, winresume.exe, or hiberfil.sys (and other boot process files). The message will typically state which file is missing or corrupt.  The earlier in the boot sequence that the error occurs, the more likely the problem is associated with BIOS or a driver. The later in the boot process, the more likely to problem is to be with missing or corrupted boot files, including hiberfil.sys. Should you receive this error message, you will want to first try a standard Windows 7 boot recovery process, including removal of the hibernation file using the powercfg.exe -h off option. This will better assure a standard winload.exe process. You can always reset hibernation mode once you know the system will boot through the standard process.

Although I focused on clearing or correcting hibernation file issues, I have been able to use hibernation mode without any problems for the past two years. Plan for the use of available drive space. Maintain disk integrity and performance using tools like disk cleanup, chkdsk and disk defragmenter. Turn off hibernation mode before making any system hardware changes, like adding or replacing RAM, to limit the variables associated with possible troubleshooting efforts. These proactive efforts should help you to avoid hibernation file issues. 

Enjoy the enhanced protection that hibernation mode affords
Steven Fullmer
Interface Technical Training Windows 7 Instructor and PMP

Videos You May Like

Creating Users and Managing Passwords in Microsoft Office 365

0 642 3

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.   For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365    

Windows 10 Features and Navigation – December 1, 2015

0 114 1

In this recorded Windows 10 webinar from December 1,2015, Windows Instructor Steve Fullmer presents the navigation and some of the new features associated with Windows 10 including Sysinternals Tools for Windows Client, Windows core concepts, exploring Process Explorer as well as some of the features that are not yet ready for prime time but will … Continue reading Windows 10 Features and Navigation – December 1, 2015

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 602 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

See what people are saying...

  1. Avatar ibnMuhammad

    Good post, especially details about the BCD.

    However, I was seeking further details about exactly how hibernation works, and when Windows knows to resume from hibernation? For example, it’s obviously not only when hiberfil.sys is present – perhaps it saves the state to the registry or the boot manager??
    i.e. is there a way to manually resume from hibernation?

  2. Avatar Benito

    Hi good day. I have a problem on my emachines d729z windows 7 about hibernation. I have removed the hibernation function and downloaded a software that will re-enable this. But when i restarted my notebook, it says something about closing the device to prevent damage on the hard drive in blue screen. I tried to troubleshoot it using all recovery methods such as system restore, start up repair and everything else but just nothing happens. Hope u could help me. Thanks a lot.

Share your thoughts...

Please fill out the comment form below to post a reply.