wsl --export <Distro> backup.tar to back up, wsl --import <NewName> <Folder> backup.tar to restore.
Before you experiment with a distribution, upgrade it, or hand a working environment to a colleague, it is worth knowing that the whole thing exports to a single file. It is the closest WSL has to a snapshot.
Back It Up
# stop it first so nothing is mid-write wsl --terminate Ubuntu # export the whole distribution to a tar file wsl --export Ubuntu D:\Backups\ubuntu-2026-08-13.tar
The file is the entire Linux filesystem, so expect it to be large. Exporting a distribution that has been in use for a while can easily produce several gigabytes.
Restore It
# restore into a new folder, under any name you like wsl --import Ubuntu-Restored D:\WSL\ubuntu-restored D:\Backups\ubuntu-2026-08-13.tar # confirm it is there wsl -l -v
Cloning Is the Same Trick
Because the import name is arbitrary, export and import is also how you clone a working environment to experiment safely:
wsl --export Ubuntu D:\Temp\base.tar wsl --import Ubuntu-Test D:\WSL\ubuntu-test D:\Temp\base.tar
wsl --manage Ubuntu-Restored --set-default-user <name>. The account itself does come across, it is only the default that resets.Worth knowing too: this backs up the Linux filesystem, not your Windows files. Anything you keep under /mnt/c lives on Windows and is not in the tar.
Related
- Change the Default User in WSL
- Reinstall a WSL Distribution
- Uninstall a Linux Distro in WSL
- WSL Complete Guide
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.
Leave a Reply