Backing up and restoring WSL distros is easier than we think! It is simply an export of the (stopped) distro that can be moved on an external disk as an archive. Restoring a backup is importing the generated tar file.
Moreover we can add multiple instances of the same distro with exporting and then importing it.
Requirements:
- Installed WSL on the Windows
- At least an installed distro
- PowerShell or Windows Terminal
To list our current distros use the following command:
wsl --list --verbose
It will have an output something like this:
wsl --terminate kali-linux
The kali-linux is the distro name from the list command above!
Backing up a WSL distro happens with the –export option of the wsl command:
wsl --export kali-linux D:\home_lab\Kali_WSL.tar
The command will create a tar archive at the defined place.
Restoring an image happens with the –import option.
wsl --import kali-linux-restored D:\home_lab\ D:\home_lab\Kali_WSL.tar
The command will restore the saved state of our WSL distro.
If you have a comment or other opinion, visit Tom’s IT Cafe Discord Server and share it!