How to Move a Windows 10 WSL 2 Linux Distribution to Another Location

故事扮演 提交于 2021-01-01 13:54:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!