Created
January 7, 2022 03:50
-
-
Save sushant-at-nitor/fcccb8604e0a4982f542e8a8517008c9 to your computer and use it in GitHub Desktop.
Move WSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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