Windows Subsystem for Linux is awesome, but storing its files on the system drive can be limiting. Here’s how to move WSL distributions to another disk.
List Containers
wsl --list
Sample output:
Windows Subsystem for Linux Distributions:
ubuntu (Default)
docker-desktop-data
docker-desktop
Move a Container
- Shut down WSL to avoid issues:
wsl --shutdown
- Export the container:
wsl --export ubuntu N:\ubuntu.tar
- Unregister the container:
wsl --unregister ubuntu
- Re-import to new location:
wsl --import ubuntu N:\WSL\ubuntu N:\ubuntu.tar --version 2
- (Optional) Delete the exported
.tar
file after verifying the setup.
This approach preserves the distro while allowing full control over its storage location.