Skip to content

Each WSL distribution is a full Linux install, and they add up

Listing what is installed, moving one to another drive, and removing the ones you tried once.

5 min read

Trying a distribution takes one command, which is why a developer machine ends up with three. Each is a complete Linux filesystem in its own virtual disk, and none of them shrink.

What is installed

wsl --list --verbose
Get-ChildItem "$env:LOCALAPPDATA\Packages" -Recurse -Filter ext4.vhdx -EA SilentlyContinue |
  Select-Object @{n='GB';e={[math]::Round($_.Length/1GB,2)}}, FullName

The list shows names, state and WSL version. The second command finds the actual disks, and the sizes are usually a surprise because nothing in Windows surfaces them.

Removing one

wsl --unregister <DistroName>

That deletes the distribution and its disk outright, which is permanent. Anything inside it goes with it, so export first if there is any doubt:

wsl --export <DistroName> D:\backups\distro.tar

Moving a distribution to another drive

This is the genuinely useful operation, and it is export and import rather than a setting:

  1. wsl --shutdown
  2. wsl --export Ubuntu D:\wsl\ubuntu.tar
  3. wsl --unregister Ubuntu
  4. wsl --import Ubuntu D:\wsl\Ubuntu D:\wsl\ubuntu.tar
  5. Set the default user again, because import resets it.

That last step catches everyone: an imported distribution logs in as root until you set the default user in /etc/wsl.conf.

Keeping them small

  • Clear package caches inside the guest. apt clean and its equivalents, invisible from Windows.
  • Keep build output out of the home directory where you can.
  • Compact after clearing, because deleting inside frees nothing outside until you do.
  • Remove distributions you tried once. An unregister is instant and complete.

The compaction step is the one that actually returns space to Windows, covered in why WSL disks only grow.

Common questions

How do I see which WSL distributions are installed?

Run wsl --list --verbose for names, state and version, then search %LOCALAPPDATA%\Packages for ext4.vhdx files to see what each actually occupies.

How do I move a WSL distribution to another drive?

Shut WSL down, export the distribution to a tar file, unregister it, then import it to the new location. Set the default user again afterwards, because import resets it to root.

Does removing a WSL distribution free the space?

Yes, wsl --unregister deletes the distribution and its virtual disk immediately. It is permanent, so export first if there is anything inside you want.

Why is my WSL disk still large after deleting files inside?

Because the virtual disk only grows. Deleting inside the guest frees space within the Linux filesystem, and the disk has to be compacted before Windows sees it.

Read next