Windows 10 has installed a WSL 2 Linux distribution to my C: drive. The drive is running out of space. How can I move the distro to another drive?
The Windows 10 command, wsl
, can be used to move a WSL distribution to another location. The procedure uses the --export and --import arguments. For example, this command will export the distro named Ubuntu-20.04
to Moved-Ubuntu-20.04
. The imported distribution cannot be an existing distro name therefore, as shown, a different name Moved-Ubuntu-20.04
is specified.
wsl --export Ubuntu-20.04 - | wsl --import Moved-Ubuntu-20.04 d:\wsl -
If desired, you can remove the original distro, thus freeing up space, using wsl --unregister Ubuntu-20.04
. The same export/import procedure can be used to rename a distro, such as renaming from Moved-Ubuntu-20.04
back to the original Ubuntu-20.04
.
FYI, wsl
gives imported distro the filename of ext4.vhdx
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With