Freeing Up Disk Space in Windows

Back when SSDs were very expensive everyone had spinny metal disks.

Spinning disks were getting incrementaly larger so worrying about cleaning up disk junk became a non event. Then the price of SSDs came down so everyone updated to SSD drives - in the process speeding up their machines significantly.

With the speedup came a downside however.... much smaller disks.

250GB SSDs are still considered 'ok' though a 250GB regular disk would be laughed at, the number should be measured in Tb not Gb.

In addition, a lot of people switched to using virtual machines (vms) for their hosting and development projects, these too would have even smaller disks (60gb anyone?).

With these smaller disk sizes came the unwelcomed return of the need to cleanup junk from your average Windows installation.

Here are some tried and tested methods to reclaim some disk space on your Windows machine or vm. I regularly get back 20gb+ with a combination of the techniques below, not bad on a 60gb vm.

The following tips are valid on a Windows 2012 r2 machine but are applicable on other versions of windows:

1) Disk Cleanup Utility

Use the Windows disk cleaner available to Windows 7 & 2012 by installing it and running it.

Disk Cleanup Install

In powershell prompt or the powershell ise run the following:

Add-WindowsFeature -Name Desktop-Experience

Run Disk Cleanup

To manually run the tool, search for and run 'Disk Cleanup'.

To run from the command line call:

C:\Windows\System32\cleanmgr.exe /d c:

2) Shrinking Git Repo

The following command shrinks a git repo down by repacking it.
This can bring down a very large repo by many hundreds of megabytes, or not much at all depending on the state of the local copy.

cd c:/yourgitfolder
git gc 

3) Disable Hybernation

The following disable hybernation, which in turn deletes the whopping hyberfil.sys, potentially saving many gb.

NOTE: This turns off hybernation, if you use it don't turn it off.

powercfg.exe -h off

4) Uninstalling Unrequired Features

If you have features that you don't require, uninstalling them will get you some additional space.

@('InkAndHandwritingServices','Server-Media-Foundation') | Remove-WindowsFeature

5) Uninstalling Unrequired Programs

Everyone installs things they don't end up using, a good saving can be had by uninstalling these unwanted programs.

  • Search for and run 'Add or remove programs'
  • Sort the list that appears by the 'Size' column
  • Select and 'Uninstall' any chunky applications to free up more space

If you know any more good techniques for clearing space on your Windows machines let me know!

comments powered by Disqus