I've just upgraded the Windows 10 in my laptop to Redstone 1. So I had a test of the Linux subsystem (aka. WSL, LXSS or Bash on Windows). Basically, everything is fine, but there is a problem that the RootFS of WSL is located in the %LocalAppData% path (e.g. C:\Users\xyz\AppData\Local), which is also the place where my Windows OS located. It consumes a lot of the SSD hard drive space in my laptop and I hope I can move it to my external hard drive.
There is an another problem. Since the other hard drive partitions are mounted as DriveFS, it does not support some Linux filesystem features like chmod, and some of my Linux project build scripts only works in VoIFS, which only located in / and /home.
So I tried to move the whole WSL RootFS to another hard drive. Firstly I've tried to make a NTFS Junction (hard link) for C:\Users\xyz\AppData\Local\lxss. I've uninstalled the WSL completely and run mklink for the RootFS to another hard drive, and when I reinstall the WSL again, it couldn't create the new user, and it reports error with code 0x80070003.
If you are using Windows 10 version 1903 (April 2019 Update) or later, you can try the WSL command line tool with the export and import options. If you are using an older Windows 10 version, you can move the distribution to another drive using lxRunOffline.
1. Set permissions to the target folder. First, I think you must set some permissions to the folder where the distribution will be moved. You may use icacls /grant ":(OI)(CI)(F)" to set the proper permissions.
NOte: While we're working to improve this scenario in future Windows releases, please DO NOT spelunk into the distro folders from Windows or Windows apps remains: -not-change-linux-files-using-windows-apps-and-tools/
Path to distro stored in registry Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\some guid\BasePathmove distro to another location and update path in registry.(need move entire CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc directory, not just the LocalState folder)