Skip to content
Discussion options

You must be logged in to vote

From PowerShell (normal user, not Administrator):

# Modify variables below as needed/desired
$WSL_ROOT="D:\WSL"
$WSL_IMAGE_PATH="${WSL_ROOT}\images"
$WSL_OLD_DISTRO_NAME="Debian"
$WSL_NEW_DISTRO_NAME="Debian_WSL2"
$WSL_INSTANCE_PATH="${WSL_ROOT}\instances\${WSL_NEW_DISTRO_NAME"

mkdir $WSL_IMAGE_PATH
mkdir $WSL_INSTANCE_PATH

# Create a backup/export of the existing Debian in `D:\WSL\images\Debian.backup.tar`
wsl --shutdown
wsl --export $WSL_OLD_DISTRO_NAME "${WSL_IMAGE_PATH}\${WSL_OLD_DISTRO_NAME}.backup.tar"

# Import that backup into the new location/distribution:
wsl --import $WSL_NEW_DISTRO_NAME $WSL_INSTANCE_PATH "${WSL_IMAGE_PATH}\${WSL_OLD_DISTRO_NAME}.backup.tar" --version 2

# S…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lars18th
Comment options

Answer selected by xela-nosretap
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants