Reduce size of a WSL installation (Ubuntu 18 on Windows 10)

Solution 1:

WSL is a full OS, so it takes up more CPU/MEM/DSK than CygWin but less than a VM

So it depends on your use case:

  • if all you need is tail on Windows, you just install the GNU Utilities for Windows.
  • If you need something more advanced, you install CygWin,
  • If you want to have snaps, containers, ... you install WSL
  • if you need all the whistles and bells of both Windows and Ubuntu you go:

    • dual-boot if you have <16G of RAM
      or
    • Virtual Machine with Ubuntu as a host and Windows in a VM if you have lots of RAM (24G or more)
  • if you need only one or a few Windows utilities¹, you install Ubuntu without Windows but with wine
  • If you need Ubuntu, just wipe Windows because Windows takes up much more space on your hard drive than Ubuntu! >:-)

Having said all that, you can always do the following to strip WSL of stuff that you don't need:

apt list --installed
apt purge WhateverYouDontNeed
sudo apt autoremove
sudo apt autoclean

;-)

¹ Definition of "utility": a small application that does not exist under Ubuntu E.g. Notepad++, DNSBench, ... Office is not a utility: it's a hog: go dual-boot ;-)

Solution 2:

You can use docker images

See https://github.com/RoliSoft/WSL-Distribution-Switcher

They are much smaller and you can install additional apps as needed.

In addition some docker images come with pre-configured tools.

See https://hub.docker.com/explore/

I have used several docker images successfully.

Solution 3:

Have you looked at cleaning up your Windows' rootfs cache?

How do I reduce the size of WSL rootfs?

This reduced the space used by WSL Ubuntu 18.04 on my Windows 10 C: drive by 62 GB.