This tutorial is about How to backup Linux distro on WSL. Recently I updated this tutorial and will try my best so that you understand this guide. I hope you guys like this blog, How to backup Linux distro on WSL. If your answer is yes after reading the article, please share this article with your friends and family to support us.
Table of contents
Check How to backup Linux distro on WSL
Microsoft has introduced the Windows Subsystem for Linux (WSL) in the Windows 11 operating system, a feature that was first released with Windows 10. WSL has also been moved to version 2 (also known as WSL2) that accompanies the performance updates. Assuming you’ve been using the WSL feature to run a Linux virtual machine on your Windows 11 PC, then it’s smart to back up your distribution, just in case you need it later in case something goes wrong. Fortunately, the Windows operating system allows clients to do the same. In this step by step guide, we will show you the process to backup your Linux file to your preferred location on Windows 11 system with wsl order device for WSL2 using command prompt.
Take a backup of the Linux distribution in WSL
To back up a WSL Linux installation on Windows 11 (or Windows 10), follow these steps.
- Open Start in Windows 11.
- Search for Command Prompt, right-click on the top result and select the Run as administrator option.
- Type the following command to determine the available Linux distributions and press Enter: wsl –list
- Type the following command to create a backup copy of the WSL distribution and press Enter.
wsl –export PATH OF DISTRO NAMEFILENAME.tar
- In the command, change DISTRO-NAME and PATHFILE-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 distribution.
wsl –export Ubuntu ubuntu-backup.tar
- Once you complete the steps, the virtual machine will be exported to the root of the main system drive (C:) unless you specify another location.
- These instructions only create a backup of a distribution. If you have additional installations, you will need to repeat the steps.
Perform Linux distribution restore on WSL
To import a Linux distribution from backup into Windows Subsystem for Linux 2, follow these steps.
- Open Home.
- Search for Command Prompt, right-click on the top result and select the Run as administrator option.
- Type the following command to import or restore Linux distributions from backup and press Enter:
wsl –import DISTRO NAME PATH TO INSTALL LOCATIONFILENAME.tar
- In the command, change DISTRO-NAME, INSTALL-LOCATION, and PATHFILE-NAME.tar with the information for your distribution.
- For example, this command restores (imports) the Ubuntu distribution.
wsl –import Ubuntu C:UsersUSERNAMEDistros C:ubuntu-backup.tar
- Type the following command to confirm that the distribution has been restored and press Enter.
wsl –list
Final remarks: How to backup Linux distro on WSL
I hope you understand this article, How to backup Linux distro on WSL. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.