Free up disk space

July 18, 2021

Before you begin installing new things, it's probably a good idea to uninstall some old things.

A general tip about software security, if you need it, upgrade it, otherwise remove it.

Delete Windows Updates temporary files.

Search for Disk Cleanup


Click on the Clean up system files button system files

If your computer was like mine, selecting Windows Update Cleanup will free up the most space.

system files

Click OK

Enable Compact OS

Compact OS is a Windows feature designed for storage constrained machines, typically a budget 32 or 64 GB MMC device. If you're running low on space, or just want to shrink Windows binaries. In my case, I gained an extra 2.5 GB!

# View the usage
Compact /?
# check if it's already enabled
Compact /CompactOs:query
# enable it
Compact /CompactOs:always

Compact OS

Disable Fast Startup

Windows has a feature called Fast Startup; personally I think it should be called Slow Shutdown. Everytime you shutdown, all the contents in memory are written to the disk, so when you turn back on your computer, it will restore from the disk. This is basically hibernate in disguise. If you have an SSD, or even an MMC, it's not worth it, so turn it off.

Open Settings, and look for Power & sleep. powerandsleep

Click on Additional power settings.

Click on Choose what the power buttons do poweroptions

Click on Change settings that are currently unavailable powerbuttons

Uncheck Turn on fast startup uncheck

Disable Hibernate

I always found hibernate is more trouble than it's worth. Somehow, it never quite resumes properly for me. Maybe you have better luck, but I don't, and I'd rather have another 4 GB (or however much memory you have) of free disk space.

# these two commands must be run as an Administrator
# delete the hibernate state file if it exists
Get-ChildItem C:\ -Hidden -Filter hiberfil.sys | Remove-Item


Check available space

Now that we're all done freeing up some space, here is a neat PowerShell command to see how much space you have available, in Gigabytes

((Get-Volume -DriveLetter C).SizeRemaining / 1024 / 1024 / 1024).toString("#.##")

SizeRemaining returns the number of bytes, so we convert that to Gigabytes, and round to 2 decimal place.