How to move Ubuntu on Windows to Drive D or other drive?
Currently Ubuntu running on Windows can only be installed in C drive of Windows. Other applications can be moved to Drive D or other drive. When trying to move the installed Ubuntu on Windows, it throws this message:
Is there a way to move Ubuntu to other drive?
Solution 1:
Disclaimer: Moving Windows Store Apps is not directly supported. The following steps are like workaround. This only works with WSL distribution packages and not for all Windows Store packages. As the question asked with using Ubuntu 18.04, the paths are related to that specific version. But this method works mostly every distribution installed in WSL.
If distribution is not installed:
- Run this command in Powershell which opens the install location of that Windows Store package.
Explorer.exe (Get-AppxPackage *Ubuntu*).InstallLocation
Replace Ubuntu with your installed distribution name. For Ubuntu 18.04 the folder path is:
C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc
- Copy the
install.tar.gz
andubuntu1804.exe
(or other name) where you want to install. - Run
ubuntu1804.exe
which will install the distribution. This may take some time. After successful installation, there will be arootfs
andtemp
folder.
If distribution is installed:
This method only works in Windows 10 Build 18305 or above.
- Close any running instances of that WSL distribution.
- List the installed distribution to get distribution name:
wsl.exe --list --all
- Export the required distribution to a tar.gz file:
wsl.exe --export Ubuntu-18.04 D:\MyFolder\MyFile.tar.gz
- Import that same file but with different path and different name:
wsl.exe --import MyDistro D:\MyFolder D:\MyFolder\MyFile.tar.gz
- Launch the distribution:
wsl.exe --distribution MyDistro