How to import a Windows Subsystem for Linux (WSL) distribution from a .tar file
Getting a previously set up Linux distribution back up and running is a breeze.
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
wsl --list
command, and you should now see your newly imported distribution.
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
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
filename.tar
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 a Managing Editor at Windows Central with over a decade of experience. 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 steering the site's coverage of all manner of PC hardware and reviews. Find him on Mastodon at mstdn.social/@richdevine