Monday, 25 February 2013

Ways to free up space on your windows OS

Reclaim space after applying Windows 7/2008 R2 Service Pack 1

I recently noticed that the free space on 60GB OS partiton on our production servers were running very low on space. Some of this was due to old offline files which I managed to cleanup fine.

If RAM is upgraded there might be chances of the pagefile to grow in direct proportion with the amount of memory, soon you will be running out of disc space.

Therefore, I searched around for ways to clear up large amounts of space and here are a few that I found most effective (and of course, this would work on any Windows 7 system, regardless of hard drive type or size):

1. Disable hibernation:
If you don't use the hibernate feature, turn it off – it's a quick and easy way to save a bunch of space as it creates a 'hiberfil.sys' file in the root of your C drive to dump the contents of your memory for when your system hibernates.  For example, if I were to disable hibernation on this machine, I'd clear up about 6gb of storage space!  (note, in order to see this file in explorer, you'll need to enable viewing hidden/protected operating system files)

To disable hibernation, open a command window with administrator privileges by right clicking Command Prompt and select Run as Administrator

and type:

powercfg –h off

You probably won't see any sort of confirmation, but if you look back at the root of your C drive, you'll see that hiberfil.sys is gone and you now have a lot more free space.   (thanks to for showing how to do this!)

2. Clean up your WINSXS directory:

In trying to find things to delete to free up space, I ran across a program called WinDirStat which helped me find files and directories that were taking up a lot of space – besides the hiberfil.sys and pagefile.sys, one of the largest culprits was the c:\windows\winsxs directory which was initially taking up 10.2gb on my machine. TreeSize s/w also is handy tool to discover folder size:

After a bit of research I managed to use the command below and reduced the winsxs by 7GB 

The process almost takes 15-25mins and I could attain a total of 7GB space on primary drive.

With that info in hand, I found out that the winsxs directory basically holds files pertaining to installing of programs, windows updates, and items like that . Anyway, there's a way to clean some of this up by running a command to delete some of these files.  Depending on what updates you have performed (such as Service Pack 1), this may not do anything, but go ahead and try.

The tool you will be running is the "Deployment Image Servicing and Management Tool" – when I ran it, it shrunk my winsxs directory from 10.2GB down to 6.8GB which freed up another 3.4GB.  To do so, run an elevated command prompt again (like with disabling hibernation above), and run the following command:

dism /online /cleanup-image /spsuperseded

(as mentioned, depending on your setup, you may not have any service packs to clean up, in which case you'll get a message such as the one below:)

3. Move your program installer files:
Every time you install a program, there's also an 'uninstall' file that is left behind that will let you repair/uninstall that program.  As it turns out, a lot (all?) of these files are stored in the \windows\installer directory and can take up a lot of space.   What you can do is move these files to a different location so you can free up space (and if you need to uninstall, upgrade, change any of those programs, simply move the files back before hand).  Navigate to the C:\windows\installer directory and sort by file size. 

Now, you probably could just move all of these files, but I just chose to remove the larger ones that would free up the most space.  If you want to know what program uninstaller you are moving (so you can move it back in case you want to edit or uninstall it), simply right click it, select properties, and choose the Details tab.  For example, "140e3d3.msi", weighing in at ~102MB, is the uninstaller for Adobe Photoshop Lightroom 3.4RC: 

So, you would just simply move it off to another other hard drive to free up 102MB!  Continue to do this for any other files you want to move to save more space.

also refer

Check folder size for housekeeping directories