How to backup Linux distro on WSL

Yes, you can backup and restore a Linux installation in the WSL platform for Windows 11 and Windows 10 – here's how.

WSL distro backup
WSL distro backup

The Windows Subsystem for Linux (WSL) allows you to create a backup (export) of your Linux distributions so you can restore (import) them in a new setup of Windows 11 or Windows 10, another computer, or when you want to share the distro with other people.

Whatever the situation might be, you can use the wsl.exe tool with the --export option to backup and the --import option to restore a distribution. However, there is one caveat, when using this method, the Linux distribution (for example, Ubuntu, CentOS, Debian, Mint, etc.) will lose its integration with the Start menu, and it’ll no longer appear as an item in the “Apps & features” settings.

This guide will teach you the steps to back up and restore Linux distros installed in the Windows Subsystem for Linux 2 (WSL2) on Windows 11 and 10.

Perform backup of Linux distro on WSL

To backup a WSL Linux install on Windows 11 (or Windows 10), use these steps:

  1. Open Start on Windows 11.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to determine the available Linux distros and press Enter:

    wsl --list
  4. Type the following command to create a backup of the WSL distro and press Enter:

    wsl --export DISTRO-NAME PATH\FILE-NAME.tar

    In the command, change DISTRO-NAME and PATH\FILE-NAME.tar with the information for your distribution. If you don’t specify a path, the backup will be stored in the root of “C:”. For example, this command backs up (exports) the Ubuntu distro:

    wsl --export Ubuntu ubuntu-backup.tar

    WSL distro backup command

Once you complete the steps, the virtual machine will export to the root of the main system drive (C:) unless you specify another location.

These instructions only create a backup of one distro. If you have additional installations, you will need to repeat the steps.

Perform restore of Linux distro on WSL

To import a Linux distro from backup on the Window Subsystem for Linux 2, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to import or restore the Linux distros from backup and press Enter:

    wsl --import DISTRO-NAME INSTALL-LOCATION PATH\FILE-NAME.tar

    In the command, change DISTRO-NAME, INSTALL-LOCATION, and PATH\FILE-NAME.tar with the information for your distribution. For example, this command restores (imports) the Ubuntu distro:

    wsl --import Ubuntu C:\Users\USERNAME\Distros C:\ubuntu-backup.tar

    WSL restore distro command

    Quick note: The original installation location is C:\Users\USERNAME\AppData\Local\Packages. However, you may want to avoid this location because the restoration won’t be identical to the original. For example, you will end up with a “.vhdx” file, and the integration won’t be the same as previously mentioned.
  4. Type the following command to confirm the distro has been restored and press Enter:

    wsl --list
  5. Type the following command to launch the distro on the Windows Subsystem for Linux and press Enter:

    wsl --distribution NAME-DISTRO

After you complete the steps, the distribution will import to the specified destination. The only caveat is that this backup and restore don’t have the same integration as installing the distros from the Microsoft Store. For example, once the distro is imported, it won’t register in the Start menu and won’t appear as an app you can remove from the “Apps & features” settings page.

If you want to run the distro, you’ll need to run this command: wsl --distribution DISTRO-NAME, or you can select the distribution from the Windows Terminal menu. Also, if you want to uninstall the imported Linux virtual machine, you will need to use this command: wsl --unregister DISTRO-NAME.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].