Skip to content

Instantly share code, notes, and snippets.

@jez321
Last active April 6, 2020 12:20
Show Gist options
  • Save jez321/5606fff0374e94d3a726d51c78e269e0 to your computer and use it in GitHub Desktop.
Save jez321/5606fff0374e94d3a726d51c78e269e0 to your computer and use it in GitHub Desktop.
Moving WSL path to a different drive/folder
1. Install WSL
2. List WSL installations
PS C:\WINDOWS\system32> wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
3. Export desired installation to a .tar file
PS C:\WINDOWS\system32> wsl --export Ubuntu S:\ISOs\ubuntu-wsl.tar
4. Unregister the installation
PS W:\VMs> wsl --unregister Ubuntu
Unregistering...
5. Register the installation to the new path
PS W:\VMs> wsl --import Ubuntu W:\VMs\ubuntu-wsl S:\ISOs\ubuntu-wsl.tar
6. Check that the installation was successfully registered
PS W:\VMs> wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
Changing the default user (after moving the path the default user will be root)
ubuntu config --default-user <user>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment