Tuesday 23 February 2010

Windows 7 (and Vista) - Reclaiming Disk Space

An Annoyance
For those of you running Windows 7 or Vista on a Desktop machine the ability to "Hibernate" seems a pretty redundant thing to do as it fills up your hard drive with a snapshot of your previous session.   It may have it's uses if you can't be bothered to save jobs as you are doing them but leaving Windows to work out what it should and should not do is problematic at best.   This is less true for laptops in as much as if your battery gets very low the last thing Windows does is copy your present work to the hibernation file but once again if yousee your battery is getting low then either save your work of if possible plug it into the mains.

Linux and Mac users do not have to worry as (hopefully) they have a "Swap" partition installed on their computer so if you hibernate it is this partition and not the one used by the operating system that is used.  These temporary files are then removed once the machine is fully rebooted.

So What's the Annoyance?
The trouble with the hibernation file is that it takes up a lot of hard drive space and can be very fragmented which makes normal defragmentation virtually impossible leading to a drop in performance.   Those of you who use "Defraggler" will notice under the files tab one named "hyberfil.sys", you will also notice that it can not be "defragged", so here is how to remove this nasty file in Windows 7.   It may work with Vista but as I don't use it (and nor should you) so I don't know.

Being an Administrator
Unlike XP, Microsoft actually got something right which was to be make alterations to your operating system harder, although not that hard, so to get rid of this annoyance you have open what looks like an old "DOS" window as administrator .  To do this click on the "Start" menu then click "All Programs" (one day they will learn how to spell) click "Accessories" where you will see the command prompt.   You have to right click this and click "Run as Administrator".


What to Do Next
OMG!   It's a command line, sorry about that but to make things simple you can either type this is or copy and paste it at the end of the prompt.   powercfg.exe -h off   .   Hit the "Enter" key, then type "exit" followed by the enter key again and that black little window will disappear. 
That is basically it but I would now suggest a reboot and once Windows 7 has restarted  then open "defraggler" and that annoying file will have disappeared and you can do a full and proper defrag of your hard drive.


What If I Want Hibernation Back?
It is doing the above but after the command prompt type    powercfg.exe -h on , exit and reboot and you are back where you started.

No comments: