How to Backup a WSL 2 Linux Distribution

In this post, you will learn how to back up a Windows Subsystem for Linux (WSL) distribution to a local disk using the wsl.exe command-line utility.

This post follows the previous article where we learn how to check which version of WSL your Linux distribution is running.

Export

When it comes to backup WSL distributions, we need to use the WSL command-line utility, and the actual command argument is export and not backup.

To backup, your WSL distribution, Open a PowerShell terminal session and run the following command to list all the WSL distributions on your machine.

  wsl --list -v 

The output should look like this, note down the distribution name under the name.

   NAME            STATE           VERSION
 * Ubuntu-20.04    Running         2 

To backup WSL, use the following command with the name of the Linux distribution. You also need to provide a full path (folder and filename).

 wsl --export Ubuntu-20.04 C:\WSL-Backup\ubuntu.tar

Top WSL Post


Posted

in

by