Tuesday, July 19, 2011

Disabling Windows Pagefile & Hibernation to Reclaim SSD Space

With the storage space offered on traditional HDDs, SSDs can leave a bit to be desired. Making matters worse are the Windows hibernation mode and pagefile, responsible for hogging at least 8GB (22GB in my case) of your precious SSD space. We're taking a look at the caveats of disabling both, and discuss the fixes.

A couple of weekends ago, I spent some time cleaning up my OS SSD in order to make room for some large benchmarking files I needed. After running Windows' Disk Cleanup tool, and making sure there were no gargantuan files or folders in my Users folder, I had a mere 20GB free. For the record, that's not much.

After spending some time going through my drive trying to find out what it was that could be hogging so much space, I discovered two simple files in the root folder (C:\) that in all regards could be considered hogs: hiberfil.sys and pagefile.sys. The pagefile is of course expected, but it's not one I considered up to this point. After all, with 12GB of RAM, a pagefile has limited use.

hiberfil.sys is the file that saves the current OS image to disk for the sake of using the hibernation mode. If you don't ever use hibernation, but instead use sleep or simply turn off your PC, then that file becomes nothing more than a space-eater, and a big one at that.

SSD Optimization - Disabling Hibernation and Pagefile

Generally, a pagefile in Windows will be the same size as the system RAM. Have 8GB of RAM? Your pagefile.sys file will be just about the same. The file's purpose is to act as a cache to speed up performance, but if equipped with a lot of RAM and also an SSD, the need for it in most cases, is nil, and thus can be removed.

There are a couple of caveats with this, however. Your pagefile.sys is what stores all of the information that gets echoed into a system log file after a crash. If the pagefile is either disabled or stored on another drive, specific information will not be stored. In the event of the pagefile being moved or disabled, and you experience continuous crashes that should be logged, it will take little effort to reactivate the file temporarily.

On a big hard drive, the need to disable or move the pagefile almost doesn't exist, because hard drives can store a lot more than an SSD at this point in time. 12GB means nothing on a 500GB drive, but it does mean something on a 120GB drive, especially when Windows itself can take about 15GB on its own. You have a couple of options:

  • Disable the pagefile.
  • Limit the size of the pagefile.
  • Move the pagefile to an alternate drive.

If your PC is equipped with a lot of RAM, 8GB or more, disabling the pagefile might not be a bad idea. But, if you are a super-heavy multi-tasker, another option is to move the file off of the SSD to a hard drive in the system, or limit how large it can become. In my case, I'm keeping the pagefile on the same drive, but configuring it to start out at 16MB and top out at 4GB. Since doing this, I have yet to see the pagefile grow larger than 16MB.

Modifying the Pagefile

To access the pagefile (or virtual memory) configuration, you can click the Start menu and type in 'advanced' into the field, and when "View advanced system settings" appears, click it. Another way to get here is to right-click Computer in your Start menu, right-click it and go to Properties, and then access the option to the left. Once loaded, click on the Settings button under the Performance section, and then click on Advanced. Under the Virtual memory section, click on Change. You'll see a screen like this:

SSD Optimization - Disabling Hibernation and Pagefile

Here, you can see that I have disabled the option to have Windows automatically manage the pagefile size, and instead set it to start out at 16MB and cap at 4GB. For me, this has worked out well, as the pagefile so far hasn't been touched at all. Another option, as mentioned, would be to disable paging on the C: entirely, and instead have Windows create one on another drive. Just be warned that if the pagefile does get accessed on a hard drive, it might result in some slower performance, but I believe that noticing the performance difference would be near impossible.

For those with 4GB or 6GB of RAM, or less, I might recommend keeping the pagefile on the C:, but still change both the initial and maximum sizes. There's no need of a pagefile using up many gigabytes when it serves no purpose.

Disabling Hibernation

That takes care of one problem. What about hibernation? Hibernation, in the simplest terms, stores the current OS image to the hard drive, allowing the PC to be put into a powered-off state while retaining the ability to resume from where you left off. This is a bit different than sleep, which does the same sort of thing, but stores the OS image to the RAM. Sleep draws some power from the socket, however, although it's minimal. It also doesn't require the need for a huge file to be stored on the hard drive.

Unfortunately, while a pagefile can be located on a non-OS drive, the hiberfil.sys file can't be. It's OS drive or bust, so if you do use hibernate, then you're effectively stuck with this monolithic file. For those who don't use it (like me), it can be disabled with one simple step. Open up a command-line by typing "cmd" into the run line or Start menu field and once opened, type in 'powercfg -h off' without quotes.

SSD Optimization - Disabling Hibernation and Pagefile

Couldn't be easier. Once that's done, the hiberfil.sys file on the C: drive will cease to exist, freeing up precious space on your SSD. In my case, reducing the pagefile size and disabling hibernation restored a staggering 22GB. When we're talking about a 120GB SSD, that's not minor. I went from having 20GB free to having 42GB free. Much, much better.

So, if you have an SSD and want to get the most out of it by getting rid of two things you might not even use, spending a couple of minutes fixing the problems can really pay off.

http://techgage.com/article/disabling_windows_pagefile_hibernation_to_reclaim_ssd_space/

No comments:

Post a Comment

Custom Search
Powered By Blogger