Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Waking up to 1GB of Free Disk Space on Your Primary SSD

blog/cards/waking-up-to-1gb-of-free-disk-space-on-your-primary-ssd.jpg

Learn how to figure out exactly where your disk space is going with WinDirStat because the built in Windows 10 tools do not do their job.

Quick Jump: Tracking Down Disk Space Usage with Windows 10 | Using WinDirStat to Solve the Mystery | Final Thoughts

Like most days, I unlocked my workstation by signing in and things looked pretty normal except I noticed a single notification from Windows 10.

The programs I left running from the previous day were still there so that rules out that Windows 10 decided to reboot over night and then warn me that I have Windows firewall disabled which is what normally happens.

So I checked it out and Windows said I was low on disk space. Hmm, that’s weird. My SSD is 256GB and I usually have around 150GB free. I looked at the drive and it had 1GB left. WTF?

Tracking Down Disk Space Usage with Windows 10

At heart I’m still an old school Windows XP user in my mind so I did what was natural to me to begin searching where the missing ~150GB went. That means right clicking a bunch of folders to see what total disk space is being used.

Disk space usage from a few potentially large folders:
  • Program Files and Program Data used 9GB
  • Windows used 16GB
  • Windows.old used 14GB
  • Users used 37MB (not GB, MB)

I had just upgraded to Windows 10 (Spring 2018) which explains the Windows.old directory, but still, if you add all of that up, that’s only 39GB.

Then I went to the Disk Cleanup utility and it showed less than 1GB of space that could be recovered from temporary files. It wouldn’t let me remove the Windows.old directory there because I had manually tried deleting a few other Windows upgrade related folders on my own before I learned about Disk Cleanup.

That was really curious because I knew for a fact the Windows System for Linux (WSL) stores its file system in the Users directory and it’s for sure way bigger than 37MB.

That lead me to believe that right clicking a folder to find disk usage cannot be trusted so I started Googling on how to “really” detect disk usage in Windows 10.

If you hit Win + S and search for “Storage” you’ll find a better utility that breaks down disk space usage across a drive. In my case it showed 38GB for “Other” and then about 150GB for “Apps & games”.

That’s really crazy because I don’t have a single game installed on my SSD and there’s very few applications installed, so I drilled in deeper and one of the apps it had listed was Ubuntu.

That makes sense because I am running Ubuntu in WSL, but the problem here is it wouldn’t show how much disk space was being used by that app, it was literally a blank label.

The disk space is hidden for Ubuntu:

blog/storage-ubuntu-is-empty.jpg

So now there’s 2 mysteries. There’s figuring out what’s up with Ubuntu / WSL because that’s really the only app that could possibly be using up so much space and then there’s the 38GB “other” amount from before.

Using WinDirStat to Solve the Mystery

I’ve never heard of WinDirStat before but while searching around it was a recommended choice for seeing what’s up with your disk space usage.

You can download it for free at https://windirstat.net/. There’s also comparable apps for MacOS and Linux listed on that site too if you’re not using Windows.

In 30 seconds I saw a real disk space usage break down:

blog/disk-space-usage-with-windirstat.jpg

Well, that’s interesting. Pretty much all of the disk space was being used by the WSL installation which as mentioned before is installed under the User directory.

I have no idea why Windows only thought it was using 37MB when it was using over 125GB.

The .trec files are from Camtasia. Those are my course’s raw video files.

The .mp4 files are my rendered videos along with a bunch of other courses that I have purchased over the years.

The .vh file is a Hyper-V image, which happens to be 38GB which in turn matched up exactly with the 38GB “other” file from the Windows Storage tool.

Immediately Understanding What Went Wrong

After seeing that a majority of the disk space was in /mnt/f it all started to make sense.

A few months ago I wrote about how I use Bash and rsync to back up all of my files on a nightly basis. Take a look at this snippet from the article: target_path="/mnt/f/backup".

It all adds up now because after upgrading Windows 10 to the Spring 2018 edition, I was able to use WSL’s new /etc/wsl.conf file to set a custom root mount path for all of my drives.

Previously it was /mnt, but now I changed it to /. This means my drives are now mounted at /f and /e instead of /mnt/f and /mnt/e.

When my backup script ran, it backed everything up to /mnt/f which is my external HD, but since it’s mounted to /f now then /mnt/f is really just a path that exists directly on my C drive (inside of WSL) which is the SSD.

I updated my backup script to use target_path="/f/backup" and it ran successfully, then I ran rm -rf /mnt/f to clean things up. Voila, I’m back up to my normal disk space.

If you ended up doing the same thing as me, you can safely delete your empty /mnt/X folders. If these didn’t exist in the first place then my backup script would have failed.

I also discovered that 38GB Hyper-V file was Docker’s VM, so that’s normal.

The last thing I did was explore the Storage settings within Windows to figure out how to delete that Windows.old folder. For that, you can click your drive, then goto “Temporary files” and you can safely remove older Windows installations and other junk there.

And now I’m back to 152GB of free space, victory!

Final Thoughts

I really wish Microsoft would fix their disk space reporting tools, but I will say this, I was surprised at how well Windows 10 ran with such limited space. Everything was still very snappy and usable.

If it weren’t for the notification I wouldn’t have even known I was dangerously low on space unless I happened to see the red warning bar on my drive in File Explorer.

Do you have any out of disk space stories to share? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per month (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.


Comments