以前旧版时有import和export方式
WSL2迁移开源工具推荐:
WSL2 Distro Manager
https://github.com/bostrot/wsl2-distro-manager
推荐的最后一种方式,ext4.vhdx + 注册表修改
在每台想要用的电脑上构建如下注册表(以.reg结尾),注意需要替换所有【】部分内容,同时删除【】。
Windows Registry Editor Version 5.00
[HKEY_USERS\【SID】\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\{【UUID】}]
"State"=dword:00000001
"DistributionName"="【子系统版本】"
"Version"=dword:00000002
"BasePath"="D:\wsl2\ext4.vhdx"
"Flags"=dword:0000000f
"DefaultUid"=dword:000003e8
其中SID可以用如下办法查看:
whoami /USER
UUID可以用如下链接自动生成:
www.uuidgenerator.net