Importing a Linux distro into WSL from a file in Windows 10

Home / Web development / Importing a Linux distro into WSL from a file in Windows 10

As we have already seen, you can backing up your Linux distribution in WSL. Now let's see how you can import a Linux distro into WSL from a tar file containing the filesystem backup, which in practice allows you to import any distro you want, with any configuration you want. In addition, you can specify any name and a custom location to store the distro you are going to import.

To import a WSL distro from a file, do the following.

  • Step 1: Open the Start menu on your Windows 11 computer.
  • Step 2: Search for "Command Prompt" or "PowerShell". In the search results, right-click on the desired application and select the "Run as administrator" option.
  • Step 3: At the console, enter the following command:
wsl --import   .tar

Remember to change "distro-name" to the name you want to assign to the distro you are importing, "install-path" to the full path of the folder where you want to store this WSL distribution, and finally "file-name" to the full path of the TAR file where the backup is located.

And that's it. Note that when you use the WSL tool with the -import option to create a new distro, it will lose its integration with the Start menu, and will no longer appear as a program in the Windows configuration.

<i class="fa fa-angle-up" aria-hidden="true"></i>