Need help on moving WSL instace to another drive
Is anyone ever moved WSL instance to another drive or location? I might need to reformat my windows partition but I want to preserve my WSL instance. Any help or suggestions are welcome. Thanks!
Windows Forum
Is anyone ever moved WSL instance to another drive or location? I might need to reformat my windows partition but I want to preserve my WSL instance. Any help or suggestions are welcome. Thanks!
by rproffitt edited
I don't want to spoil the answer but RIGHT NOW you would be preserving it. Tell me how you keep it safe with the backups and one more step.
The answer is at your fingertips such as https://www.google.com/search?q=WSL+instace+to+another+drive
by thewelltags
Moving a WSL instance is straightforward using the built-in export and import functions. This creates a standalone compressed file that you can store on an external drive while you reformat.
1. Export your instance
Open PowerShell (as Administrator) and list your distros to get the exact name (e.g., Ubuntu):
PowerShell
wsl --list --verbose
Shut down WSL to ensure no data corruption:
PowerShell
wsl --shutdown
Export the distro to your backup drive (e.g., D: drive):
PowerShell
wsl --export Ubuntu D:\wsl_backup.tar
2. Reinstall and Import
After reformatting Windows and reinstalling WSL, you can "import" that file back to any location you want:
PowerShell
wsl --import Ubuntu-New C:\WSL-Storage D:\wsl_backup.tar
Ubuntu-New: The name you want to give the distro.
C:\WSL-Storage: The folder where the virtual disk will live.
D:\wsl_backup.tar: The path to your backup file.
3. Set the Default User
When you import, WSL often defaults to the root user. To switch back to your regular username, run:
PowerShell
Ubuntu-New config --default-user yourusername
by rproffitt edited
This discussion is closed to new replies.
Sort by Trending