Whatever the reason you regularly set up a WSL environment on Windows 10, if you're doing it often, then a more efficient method is to import a previously backed up distribution. Exporting a WSL distribution is easy and takes only a moment; likewise importing one from a .tar file is just as quick.
Here's what you need to know.
Importing a previously exported .tar file
If you've used the export feature to backup one of your WSL Linux distributions, then there's a good chance you might also want to use it at some point. Whether it's just to restore a backup or move to a new machine, it's one of the most efficient methods of being up and running again with your Linux environment.
Fortunately, should the moment arise, there is an equally simple command template to import your .tar files to a specified install location.
wsl --import (distribution) (install location) (file location and filename)
So it might look something like:
wsl --import Debian C:\Users\MyPC\AppData\Local\Packages\Debian C:\Users\MyPC\Documents\debianbackup.tar
To check it imported correctly, run the
command, and you should now see your newly imported distribution.
That's all there is to it. It doesn't take very long to complete, either, and is certainly a more efficient method than continually setting up from scratch.
As long as you have access to the .tar file on another machine, you can also use this method to move a distribution you've set up in one place over to another. It can certainly shave a chunk off the setup time for your WSL environment on another PC.
A note about exporting
We have a full guide on properly exporting WSL distributions to a designated location on your PC, but it's worth highlighting this.
The file you're trying to use will need to be a .tar, and if you didn't specify
during your export, then you won't have the right file type, and you won't be able to use it for importing.
If you're having trouble getting the import process to work, then this is the first step to troubleshoot. You may just need to go back and re-run your export and specify the right file type.
Richard Devine is an Editor at Windows Central. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently you'll find him covering all manner of PC hardware and gaming, and you can follow him on Twitter and Instagram.
Thank you for signing up to Windows Central. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.