-
WSL2的ubuntu默认安装在C盘,占用空间较大,介绍如何将数据迁移到其他盘,主要方法就是建立一个软链接
-
一般安装路径
C:\Users\vfvaf0\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
-
将
ext4.vhdx
拷贝到其他盘, 如D:\wsl\ext4.vhdx
-
管理员权限打开cmd
-
输入
mklink "C:\Users\vfvaf0\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx" "D:\wsl\ext4.vhdx"
-
如果存在以下报错,输入
cmd
, 切换一下解释器,再执行5
步骤
mklink : The term 'mklink' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ mklink "C:\Users\vfvaf0\AppData\Local\Packages\CanonicalGroupLimited. ...
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (mklink:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException