Skip to content

Instantly share code, notes, and snippets.

@sushant-at-nitor
Created January 7, 2022 03:50
Show Gist options
  • Save sushant-at-nitor/fcccb8604e0a4982f542e8a8517008c9 to your computer and use it in GitHub Desktop.
Save sushant-at-nitor/fcccb8604e0a4982f542e8a8517008c9 to your computer and use it in GitHub Desktop.
Move WSL
REM List the running distros
wsl --list -v
REM Shutdown all distros
wsl --shutdown
REM create a directory on a different drive (not necessary) to move the data
mkdir e:\system\docker\wsl-{distro}\
REM export the distro data to tar
wsl --export {distro-name} "e:\system\docker\wsl-{distro}\{distro-name}.tar"
REM remove / unregister distro
wsl --unregister {distro-name}
REM import distro by setting up new data directory, the second arg is new data directory
wsl --import {distro-name} "e:\system\docker\wsl-{distro}" "e:\system\docker\wsl-{distro}\{distro-name}.tar" --version 2
REM delete the exported file, now you would see new .vhdx file under new distro directory
del "e:\system\docker\wsl-{distro}\{distro-name}.tar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment