问题
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?
回答1:
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
.
来源:https://stackoverflow.com/questions/62533122/how-to-move-a-windows-10-wsl-2-linux-distribution-to-another-location