This post shows students and new users steps to back up and restore a Linux distribution on Windows Subsystem for Linux (WSL). When using WSL, you can back up (export) or restore (import) Linux onto another WSL system using the wsl.exe --export and --import command options.
For those who don’t know about WSL, here’s an overview: Windows Subsystem for Linux lets developers run a GNU/Linux environment, including most command-line tools, utilities, and applications directly in Windows without setting up a virtual machine or dual-boot.
You can use WSL to run Linux within Windows without additional hardware or a dedicated virtual machine environment. In addition, its export and import feature allows you to store your Linux machine securely and restore it if the original is corrupted or not functioning correctly.
One caveat when using the export and import method is that the Linux machine will lose its integration with the Start menu and no longer appear as an item in the Apps & features settings after you import it. But all other functionality will remain.
Below is how to use the export and import feature with WSL.
How to backup and restore Linux machine on WSL
As mentioned above, when users use WSL, they can back up (export) Linux or restore (input) onto another WSL system easily using the wsl.exe --export and --import command options.
To backup Linux in WSL, go to the Start menu in Windows, then search and open the Command Prompt as administrator.

Once the command prompt opens, you can list all available Linux OS in your WSL environment.
wsl.exe --list
Now to backup a Linux OS named (Ubuntu-20.04), use the command format below:
wsl --export Ubuntu-20.04 C:\Windows\Ubuntu-20.04.tar
Change the Linux machine name to the one in your environment and the destination path to where you want to store the backup file.
The example above shows the destination backup location in the C:\Windows folder.
Once the file is backed up, you can restore the machine on the same WSL host or another Windows host running WSL. To restore, use the command format below.
wsl --import Ubuntu-20.04 C:\Users\<username>\Ubuntu C:\Windows\Ubuntu-20.04.tar
Change the name of the Linux machine and the location to restore the Linux machine. By default, Windows stores Linux machines in the following location:
C:\Users\<username>\AppData\Local\Packages
If you want to restore the machine to the default location, use the default location instead.
That should do it! However, exporting and restoring a Linux machine using the steps above won’t have the same integration as installing the distros from the Microsoft Store. For example, it won’t register in the Start menu or appear as an app on the Apps & features settings page.
Conclusion:
- Backing up and restoring a Linux distribution on Windows Subsystem for Linux (WSL) is a straightforward process using the wsl.exe –export and –import commands.
- WSL enables users to run a full Linux environment on Windows without additional hardware, facilitating development and testing.
- Users should remember that after importing a backed-up Linux machine, it will not integrate with the Start menu or appear in the Apps & features settings.
- Always ensure to choose the correct Linux machine name and destination paths during the export and import processes.
- Regularly backing up your WSL environment can help prevent data loss and ensure quick recovery in case of issues.
Leave a Reply