WSL Ubuntu Windows
Move a WSL Ubuntu that eats up C-drive space to another disk, freeing the system drive while keeping all installed software and settings. The approach: package with wsl --export into a tar, redeploy with wsl --import to the new location, switch the default, then clean up the old install.
The migration temporarily stops the WSL service, so do it outside working hours. The whole process takes about 30 minutes to 2 hours depending on system size.
Before you start
Requirements
| Item | Minimum | Recommended | Notes |
|---|---|---|---|
| Disk space | Ubuntu size × 1.2 | Ubuntu size × 1.5 | Target disk needs enough room |
| RAM | 4GB | 8GB+ | Large systems need more memory |
| Windows version | Windows 10 v1903 | Windows 11 | Newer versions have better WSL support |
| Privileges | Standard user | Administrator | Admin rights avoid permission issues |
Backup strategy
Migration is relatively safe, but take precautions first.- Back up key data
- System restore point
Ubuntu is fully packaged and redeployed during migration. Back up important user data to the cloud or external storage, especially:
/home/<username>/: user home directory/opt/: third-party software- custom config files
Migration steps
Check system state
Open PowerShell as administrator and list all WSL distros (name, state, WSL version, default marker):
Record the exact distro name (e.g.
Ubuntu-22.04); later steps use it.Package the Ubuntu system
Export the current Ubuntu to a portable tar (adjust the distro name and target path):
| Parameter | Example | Notes |
|---|---|---|
Ubuntu-22.04 | distro name | The name confirmed in step 1 |
D:\ubuntu-22.04-backup.tar | export path | Full path and filename of the backup |
Deploy to the new location
Create the migrated Ubuntu instance:The parameters are, in order: new instance name (your choice), the folder where its files actually live, and the export path from step 2. Use a descriptive name (e.g.
Ubuntu-DataDisk) and avoid special characters and spaces. Run wsl -l -v again to confirm the new instance appears.Clean up the old system
Once the new environment works, remove the old Ubuntu to free the C drive:Use Disk Cleanup to check the C-drive gain, confirm the WSL folder is gone, and run
wsl -l -v to confirm the old distro disappeared. Keep the tar as an extra backup for a while, then delete once stable:Troubleshooting
- Export fails
- Deploy errors
- Startup issues
| Cause | Check | Fix |
|---|---|---|
| Not enough disk space | Check target free space | Free space or switch disks |
| Insufficient privileges | Confirm running as admin | Reopen PowerShell as admin |
| Ubuntu not fully stopped | Check WSL state | wsl --shutdown and retry |
Emergency recovery
If migration hits a serious, unrecoverable problem:- Verify the original tar exists and is intact
- Clean the problem instance:
wsl --unregister Ubuntu-22.04-diskD - Redeploy with the same import command
- If still broken, temporarily fall back to the original instance until resolved