Move Ubuntu subsystem elsewhere in Windows

After installing an Ubuntu app from Micosoft Store, open an Administrator's prompt,

1
2
3
4
5
6
7
8
9
10
wsl -l -v
wsl --export Ubuntu-22.04 e:\cext\Ubuntu\ubuntu22.04.tar
 
# or unistall it through System Settings
wsl --unregister Ubuntu-22.04
 
wsl --import Ubuntu e:\cext\Ubuntu\ubuntu22 e:\cext\Ubuntu\ubuntu22.04.tar
 
# start Ubuntu as eu
wsl -d Ubuntu -u eu

refer to:
C:\Users\eu\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState
https://blog.csdn.net/popboy29/article/details/126854886
https://blog.csdn.net/csdn_life18/article/details/128246494