Why Move a WSL Linux Distro?
Windows Subsystem for Linux (WSL) stores each Linux distribution as a virtual hard disk (VHDX) file on the system’s C: drive by default. When a user installs multiple distributions or downloads large packages, these files can occupy significant disk space. Moving the distro to a secondary drive not only frees the primary partition but also improves overall system performance by distributing I/O load.
Preparation Checklist
- Terminate All Running Instances: Execute
wsl --shutdownin an elevated PowerShell or Command Prompt. This guarantees that the VHDX files are not in use. - Verify Stopped Status: Run
wsl --list --verboseto ensure each distro shows a Stopped status. - Create Destination Folder: On the target drive (e.g., D:), create a directory such as
D:WSLUbuntuto host the new location. - Backup Critical Data: While the move is safe, it is prudent to back up important files from within the Linux environment before proceeding.
Method 1 – Direct Move with wsl --manage --move
This command offers the simplest path for most users. It relocates the VHDX file and updates registry references automatically.
- List installed distributions:
wsl --list --all. Identify the exact name of the target distro. - Execute the move:
wsl --manage --move "". Example:wsl --manage Ubuntu --move "D:WSLUbuntu" - Confirm success by launching the distro:
wsl -d. Observe that the application starts from the new location.
Method 2 – Export/Import Workflow
This approach is versatile, supporting renaming, cross‑machine transfers, or use on older WSL versions where --manage --move is unavailable.
- Export the distribution to a tar archive:
wsl --export ""Example:wsl --export Ubuntu "D:WSLubuntu-backup.tar" - After confirming a successful export, unregister the original distro to release space:
wsl --unregister - Import the tar file to the desired location and specify WSL 2:
wsl --import "" "" --version 2
Example:wsl --import Ubuntu "D:WSLUbuntu" "D:WSLubuntu-backup.tar" --version 2
Post‑import, the default user may default to root. To restore the original user, add a wsl.conf file inside the distro:
[user]
default=yourusername
Restart the distribution to verify login as the intended user.
Installing New Distros Directly to a Secondary Drive
To avoid future relocations, specify the installation path during setup:
wsl --install --location ""
Example:wsl --install Ubuntu --location "D:WSLNewUbuntu"
Important Considerations
- Disk Space Requirement: Export/Import requires temporary double space (original VHDX + tar file). Ensure sufficient free space on the target drive.
- NTFS Compression: Do not enable NTFS compression on the folder holding the VHDX; it can corrupt WSL images.
- Docker Desktop Integration: Docker Desktop creates its own hidden WSL distributions. Moving these involves shutting down Docker, relocating the data folder, and updating the “Disk Image Location” in Docker’s settings.
Verifying Space Recovery
After a successful move or import, reopen the Windows Explorer or use wmic logicaldisk get size,freespace,caption to confirm the reduction in used space on the C: drive. The reclaimed space can now be allocated to other applications or additional storage needs.
Conclusion
Relocating a WSL Linux distribution is a straightforward process that liberates primary drive storage and enhances system performance. Whether using the rapid --move command or the flexible export/import method, the steps above provide a reliable framework for users seeking to optimize their Windows 11 environment.

Leave a Reply