A simple method to install WSL on a non-system drive
By default, WSL is installed on the system drive. If there is insufficient space on the system drive, you can install WSL on a non-system drive using the following steps:
Step 1: Install a WSL distribution as usual:
wsl --install -d Ubuntu
Step 2: Export the distribution’s hard drive:
wsl --export Ubuntu D:\WSL\Ubuntu\ext4.vhdx --vhd
Step 3: Uninstall the recently installed distribution:
wsl --unregister Ubuntu
Step 4: Re-establish WSL on the exported hard drive in place:
wsl --import-in-place Ubuntu D:\WSL\Ubuntu\ext4.vhdx
Step 5 (optional): After the above operations, the default login user will be root. To switch back to a non-root user:
ubuntu config --default-user <username>