How to backup WSL2 Linux distro in Windows 11
Microsoft has introduced the Windows Subsystem for Linux (WSL) on Windows 11 operating system, a feature that was first launched with Windows 10. The WSL has also been upgraded to version 2 (aka WSL2) which comes with performance improvements.
If you have been using the WSL feature to run a Linux virtual machine on your Windows 11 computer, then it’s a good idea to take a backup of the distro, just in case you need it in the future if something goes wrong. Thankfully, Windows operating system allows users to do so.
In this step-by-step guide, we will show you the process to take a backup of your Linux distribution to the location of your choice in the Windows 11 system with wsl command tool for WSL2 using the Command Prompt.
How to backup Linux distro in WSL on Windows 11
Step 1: Open the Start menu on your Windows 11 computer.
Step 2: Search for “Command Prompt” and from the search results, right-click on the app and select the “Run as administrator” option.
Step 3: In the command prompt window, enter the following command which will show the list of available Linux distros on the device.
wsl --export DISTRO-NAME PATH\FILE-NAME.tar
Make sure to change the “DISTRO-NAME” to the actual name of the Linux distro on your system and change the “PATH\FILE-NAME.tar” to the location where you want to store the backup file. If you don’t specify a location and just specify the file name, then the backup file will be stored in the system drive.
That’s it. After following the above-mentioned steps, you will have successfully exported the Windows Subsystem for Linux (WSL) Linux distro virtual machine in the location specified or in the main system drive.
The backed-up Linux distro can now be imported to a new setup of Windows 10 or Windows 11 system, or to some another computer, and can also be shared with other people.
Do note that when using the wsl.exe tool in the Command Prompt with the –export option to backup the Linux distro, the Linux distribution will lose its integration with the Start menu, and it’ll no longer appear as an item in the “Apps & features” settings.