Created
April 25, 2023 14:44
-
-
Save oliverlabs/729eec680942716978fdfe413e265980 to your computer and use it in GitHub Desktop.
WSL Image Backup and Migration
This file contains hidden or 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
| #To move to a custom location | |
| #Terminate specific distribution | |
| wsl -t Ubuntu | |
| #Shutdown WSL (all) | |
| wsl --shutdown | |
| #export | |
| wsl --export Ubuntu s:\scratch\ubuntuwsl.tar | |
| #OR | |
| wsl --export Ubuntu s:\scratch\ubuntuwsl.vhdx #much faster | |
| #Then | |
| wsl --unregister Ubuntu | |
| #Import to location of your choice | |
| wsl --import Ubuntu s:\images\Ubuntu s:\scratch\ubuntuwsl.vhdx | |
| wsl --list --verbose | |
| #Can change the default | |
| wsl --set-default Ubuntu | |
| #Start and connect to distribution | |
| wsl -d Ubuntu | |
| #To avoid entering password at every sudo | |
| sudo visudo | |
| <# | |
| Add to end of file | |
| [$USERNAME] ALL=(ALL) NOPASSWD:ALL | |
| #> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment