![]() At this point, you can delete the disk file from the original location. ![]() Just start the WSL distribution, it will use the disk in the new location. For example, cp C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx D:\wsl\Ubuntu\.Ĭhange the BashPath entry in Registry Editor to point to this new location. This is the disk file.Ĭopy this file to the location where you want to have it. Many users want to move the user profile folder to another drive to free up disk space on the system partition, but since moving Users or profile folder to. If you open this folder, you will see that it has one ext4.vhdx file. In my case: C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState. ![]() The BasePath entry shows the current location of the disk. Find the one that you want to relocate based on the DistributionName entry (in my case, it is Ubuntu). Here, you can find all the existing distributions. Navigate to Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\. Start the Registry Editor ( regedit.exe - it requires elevated permissions). Under the 'Devices and drivers' section, open. Stop the distribution you want to relocate: wsl -terminate Ubuntu or wsl -shutdown.Ĭreate a backup, just to be sure: wsl -export Ubuntu D:\Ubuntu-backup.tar`. To move the default user account folders to a new storage location, use these steps: Open File Explorer. I have found an approach that does not require deleting (unregistering) and importing an existing distibution. You can set the new distribution as default with: wsl -set-default # Please ensure the correct distribution name When you are satisfied that the new distribution is working the same as the old, you can remove the old with: # Warning: This is a destructive and unrecoverable operation Use this answer to create a /etc/wsl.conf file to specify the default user. In the meantime, it will start as the root user. You can start this distribution with: wsl ~ -d īecause it is a new distribution, WSL needs to be told what the default username is. WSL will create a new distribution named in the directory on D. Wsl -import d:\WSL\distros\ \ext4.vhdx -vhd # Create a directory on the other drive for the distro # to the clipboard so that you can paste it into the -import command # Copy the of the distribution you want to copy ![]() (Get-ItemProperty $_.PSPATH) | Select-Object DistributionName,BasePath Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss\ | # Find the location of the existing distribution: For instance, if your distribution is "Ubuntu", the new name could be "my_Ubuntu" (I call mine "ntd_Ubuntu").Įxit WSL (and, if you use it, shut down Docker Desktop), then from PowerShell (a regular, non-admin terminal): wsl -shutdown Note that this will only work with WSL2 distributions, not WSL1.Īlso note that it is important to pick a new, different name for the copied distribution. The latest versions of WSL2 include a new wsl -import -vhd option to directly copy the existing VHD (virtual SDD drive for your WSL2 distribution) to another location. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |