TheGeekery

The Usual Tech Ramblings

Windows 2008, and Hibernation

Whilst driving back from our 4th of July celebrations in San Antonio, I got alerted to a server running low on disk space. As it hadn’t hit critical, and there was still a fair bit of space left, I decided to wait until I got home. When I looked at the server, I pulled up my trusted space analyzer, TreeSize.

imageA quick analysis of the drive, and a report showed that there was a hefty chunk of space lost to the WinSXS directory1, and 8GB of Files in the root of C:. This was a little odd, I know I usually use c:\temp from time to time, but never the root. To find out what was there, I first had to show hidden and system files. To do this, go to Tools, then Folder Options, then onto the View tab. There are 3 options there that we need to change.

  • Change “Hidden files and folders” to “Show hidden files and folders”
  • Uncheck “Hide extensions for known file types” -Uncheck “Hide protected operating system files (Recommended)”

I highly recommend doing 2 all the time, you never know when somebody might sent a .txt.exe file2. Changing 3 will prompt that it isn’t recommended, but do it anyway, the files I was having issues with were still hidden after changing the first two.

After making these changes, two files appeared that were the culprits to the lost disk space. Pagefile.sys and Hiberfil.sys. I’ll leave the explanation of the Pagefile to the experts. Hiberfil.sys is a file that is used to handle the state of memory, and running applications when you hibernate your computer.

What is hibernation?

Hibernation is a heavy sleep state for computers where all the running processes are frozen, the memory is locked, and all the states are saved into that file, then the computer is powered down. When the computer is turned back on, the operating system sees this state file, and starts to reload everything from there. This makes it appear like the computer was never even turned off. The applications are resumed, everything is back to the state it was before hibernation was kicked off.

Why is that bad?

Generally speaking, it isn’t. In fact, it’s a great thing for home computers. When you’re done reading your email at night, if you hibernate your computer, and hop into bed, your computer will be off, saving power. However this isn’t so good for servers. In 95% of cases, servers don’t ever need to hibernate. They usually have tasks, and operations that they need to run all the time, which means putting them in a state of hibernation is a bad thing as the tasks won’t be run.

How do you stop this?

Usually, servers have this feature turned off, but for some reason this particular one had it enabled. I’ve done some looking around, and it seems it’s may have actually been a default option to have it enabled, but for some (lucky) reason a handful of our other servers don’t have it on. In earlier versions of Windows, disabling the hibernation option was a case of removing a check mark from a box. This was done in the Control Panel under Power Options, and the Hibernate tab. However, in Windows 2008 this option was removed, and you now have to use a command line to manage this advanced option.

1
powercfg -hibernate off

Within about 10 seconds of issuing that command, the Hiberfil.sys file disappeared, and I recovered 4GB of disk space. You can read more about the powercfg command here.


  1. If you’ve not read about this, I strongly recommend you do when planning out a Windows 2008 server build

  2. A very old trick from virus/malware creators

Comments