The answer(s) to this question will, of course, always be changing as WSL and its distributions are updated.
It's also very difficult to measure the exact disk space utilized by any given Windows feature since Windows is constantly consuming and releasing disk space for other purposes as well. That said, here are some measurements done on Windows 11 today:
Short form:
- The WSL feature and kernel take between 100-200MB of space.
- An Ubuntu distribution takes, at a minimum 1.1GB, but will quickly expand on first update/upgrade to around 2.7GB.
- An additional ~400MB are consumed by the installed rootfs tarball, which can be recovered.
Note:
These measurements were done with the released version of WSL on Windows 11.
WSL is now available in Preview form from the Microsoft Store, and this version, when installed will consume more disk space since the features are not built into Windows. I have not yet measured the Store/Preview version of WSL.
Also, these measurements were taken with a WSL2 distribution. The initial size consumed by a WSL1 distribution will be greater than that of WSL2, however, WSL1 will release space back as files are deleted (unlike WSL2).
Details:
A fresh install of Windows 11 + Updates, before WSL installation, consumed 35,584,876,544
bytes of disk space.
After enabling the WSL feature and rebooting, 35,587,739,648
bytes were consumed. A decrease of around 2,863,104
(2.8MB). This is expected, since the feature is built in to Windows and is just "enabled" (not necessarily installed).
Note that, at this stage, WSL1 is installed and could be used with a distribution.
Enabling the Virtual Machine Platform to enable WSL2 consumed an additional 23,044,096
bytes. However, rebooting actually reclaimed 14,274,560
of this, for a net change of 8,769,536
. Again, this smaller number is likely due to the fact that the feature ships with Windows, and is just being enabled.
After downloading the 16.1MB WSL2 kernel package and rebooting, a whopping additional 568,856,576
was consumed. This number should be taken with a big caveat, in that Edge was launched for the first time in order to download the package. It's almost certain that most of the additional consumed disk space was from Edge features being activated for the first time and other side-effects.
The kernel itself, installed, takes up 73,476,524
bytes.
Installing Ubuntu 20.04 with wsl --install -d Ubuntu
is certainly the biggest consumer of disk space. After installing and rebooting, an additional 1,648,529,408
(1.6GB) was used.
There are two main parts to this. The first is the "App" itself. This includes the rootfs tarball that gets installed. It is stored in the C:\Program Files\
directory that is normally off-limited to your normal user. You can inspect the WSL tarball sizes, however, with a simple PowerShell one-liner run in an Administrative session:
Get-ChildItem -Recurse 'C:\Program Files\WindowsApps\' | Where-Object {$_.Name -eq 'install.tar.gz' }
This shows that the tarball is 452,534,052
bytes. Technically, this could be recovered by removing the App, but be warned -- Removing the app also removes the distribution. It's possible to decouple it (through a wsl --export
/--import
), though, and then remove the "App"/tarball.
The other part is the actual distribution itself, which under WSL2 can be seen in the size of the ext4.vhdx
virtual HDD. Before running any commands, the size of the vhdx
was 1,173,397,504.
After a sudo apt update && sudo apt upgrade -y
, the size of the distribution grew to 2,701,131,776
(around 2.7GB). Note that a df
showed it to be 1,513,688k
. The large change in the vhdx
size is likely due to the fact that the virtual disk can grow as needed, but does not release space as files are removed from it. See this question for details.
Update for Ubuntu 22.04: The base vhdx
size is 1.49GB. However, since it was just released today, it already includes up-to-date packages. As such, an initial sudo apt update && sudo apt upgrade -y
did not consume any additional space.
Compared to Ubuntu 20.04, that's an overall savings of around 1.2GB. Again, this will likely change as we progress through Ubuntu 22.04's lifecycle.