How to Move a WSL Distro to Another Drive

🐧Part of the WSL Complete Guide, every Windows Subsystem for Linux post on this site, organised by task.
The short answer

wsl --manage <Distro> --move <Location>. The old export, unregister and import routine is no longer necessary.

WSL puts its virtual disks on the system drive, and those disks only ever grow. On a laptop with a modest C: drive, a couple of distributions and Docker will find the limit surprisingly quickly.

The Modern Way: One Command

# stop the distribution first
wsl --terminate Ubuntu

# move it, disk and all
wsl --manage Ubuntu --move D:\WSL\Ubuntu

# confirm
wsl -l -v

WSL relocates the virtual disk and updates its own registration, so the distribution starts from the new location with everything intact.

The Old Way, Still Documented Everywhere

Most guides online still describe this three-step version, which was the only option before --move existed. It still works, and it is worth knowing because it doubles as the backup routine:

wsl --export Ubuntu D:\Temp\ubuntu.tar
wsl --unregister Ubuntu
wsl --import Ubuntu D:\WSL\Ubuntu D:\Temp\ubuntu.tar
If you use the old routine, do not skip the export. wsl --unregister deletes the distribution and its filesystem immediately, with no prompt and no recycle bin. Export first, verify the tar file exists and looks a sensible size, then unregister.

One more detail: the old routine resets the default user to root, so you will want wsl --manage <Distro> --set-default-user <name> afterwards. The --move command does not have that side effect.

Related


If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *