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:\Backup\ubuntu-2026-11-16.tar
# check the file is there and how big it is
Get-Item D:\Backup\ubuntu-2026-11-16.tar | Select-Object Name, @{n='GB';e={[math]::Round($_.Length/1GB,2)}}
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. Mine is a small one at 1.23 GB.
Restore It
# restore into a new folder, under any name you like wsl --import Ubuntu-Restored D:\WSL\ubuntu-restored D:\Backup\ubuntu-2026-11-16.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.
To run the backup on a schedule, ask Claude for a script that exports with the date in the name and clears out copies older than you want to keep. Read it before you let it delete anything.
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.
Leave a Reply