The Windows Subsystem for Linux (WSL) allows you to clone a Linux distribution, and in this guide, you will learn the steps to complete the process successfully.
Although the WSL platform doesn’t include a clone option, you can use the export and import commands to make a copy of an existing Linux distribution on Windows 11. Usually, you want to download the distributions from the Microsoft Store, but sometimes, you may need to test changes without affecting the original setup, which you may spend hours configuring.
Whatever the situation might be, you can use the
wsl.exe tool with the
--export option to export and the
--import option to restore a distribution with a different name, thus cloning the setup. However, you should be aware that when using this method, the clone 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 “Installed apps” settings.
This guide will teach you the steps to clone a Linux distro on Windows 11.
Clone Linux distro on WSL
To clone a WSL Linux distribution on Windows 11, use these steps:
Open Start on Windows 11.
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
Type the following command to determine the available Linux distros and press Enter:
Type the following command to export the WSL distro to clone 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 Linux distro. If you don’t specify a path, the backup will be stored in the root of “C:”. For instance, this command backs up (exports) the “Ubuntu” distro:
wsl --export Ubuntu ubuntu-backup.tar
Type the following command to import the WSL distro clone and press Enter:
wsl --import DISTRO-CLONE-NAME INSTALL-LOCATION PATH\FILE-NAME.tar
In the command, change “DISTRO-CLONE-NAME” with the name you want to clone to appear on WSL. Also, change “INSTALL-LOCATION” and “PATHFILE-NAME.tar” with the information for your distribution. For instance, this command clones the distro as “Ubuntu-Cloned:”
wsl --import Ubuntu-Cloned C:\Users\USERNAME\Distros C:\ubuntu-backup.tar
Type the following command to confirm the distro has been cloned and press Enter:
Type the following command to launch the clone on the Windows Subsystem for Linux and press Enter:
wsl --distribution NAME-CLONED-DISTRO
Once you complete the steps, the distribution clone will import to your destination. The only downside with this process is that the clone won’t have the same integration as those distros installed through the Microsoft Store. For instance, once the distro is imported on the computer, it won’t register in the Start menu or appear as an app in the “Installed apps” settings page.
If you want to launch the newly cloned distro, you’ll need to run the
wsl --distribution DISTRO-CLONE-NAME command. Also, if you plan to uninstall the distribution, you must use the
wsl --unregister DISTRO-CLONE-NAME command.