Step-by-Step Guide to Transfer WSL Distros to Another Drive on Windows 10 and 11

Key Notes

  • Relocate your WSL distribution easily through Settings or Command Prompt.
  • Use both Move and Import commands for flexible relocation options.
  • Ensure to shut down active distributions before moving.

Mastering the Movement: How to Relocate Your WSL Distributions on Windows 10 and 11

Are you struggling with limited space on your current drive while using Windows Subsystem for Linux (WSL)? Relocating WSL distributions can optimize your system and enhance performance. This guide outlines the crucial steps to efficiently transfer your Linux distributions to a different hard drive on Windows 10 and 11.

Relocate Linux Distribution Using Settings

To transfer a WSL distro to a new location via the Settings app, follow these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select Run as administrator.
  3. Shut down any active Linux distribution by entering the command and pressing Enter : wsl --shutdown
  4. Access the Settings app.
  5. Select Apps.
  6. Navigate to the Installed apps section.
  7. Expand the menu for the desired distribution and select the Move option.
  8. Choose the new drive for your Linux distribution.
  9. Click the Move button.

Completing these steps will transfer the necessary files to run the WSL distro to the chosen drive.

Relocate Linux Distribution Using the Move Command

Follow these instructions to move your WSL distribution via the command line:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select Run as administrator.
  3. Type the following command to list all installed distributions: wsl --list --all
  4. Shut down any running distribution with: wsl --shutdown
  5. Execute the command to relocate your WSL distro: wsl --manage [DISTRO_NAME] --move [NEW_DRIVE] Replace [DISTRO_NAME] with your specific distribution name and [NEW_DRIVE] with the path to the new location.
  6. Execute the command to launch the relocated Linux distribution: wsl -d [DISTRO_NAME]

Your distribution will now run from the new location.

Relocate Linux Distribution Using Import Command

To shift a Linux distro using the WSL import command, follow these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select Run as administrator.
  3. List the installed distros: wsl --list --all
  4. Shut down any running distribution: wsl --shutdown
  5. Export the desired distribution: wsl --export [DISTRO_NAME] [EXPORT_FILE_NAME]
  6. Unregister the Linux instance: wsl --unregister [DISTRO_NAME]
  7. Import the WSL distro into the new location: wsl --import [DISTRO_NAME] [TARGET_LOCATION] [EXPORT_FILE_PATH]

You have successfully moved your WSL distribution using the import command.

Additional Tips

  • Verify there is adequate space on the new drive before moving.
  • Create a dedicated folder for each WSL distro to avoid naming conflicts.
  • Regularly back up your WSL data before performing any relocation operations.

Additional Tips

  • Verify there is adequate space on the new drive before moving.
  • Create a dedicated folder for each WSL distro to avoid naming conflicts.
  • Regularly back up your WSL data before performing any relocation operations.

Summary

This guide detailed various methods for relocating your WSL distributions on Windows 10 and 11, including using the Settings app, the Move command, and the Import command. Remember to shut down active distributions and back up your data prior to initiating a move.

Conclusion

Transferring your WSL distributions to a different drive can enhance your system performance, especially if you’re low on space. Follow the methods outlined in this guide to ensure a seamless relocation process. Don’t hesitate to explore these commands and customize your development environment effectively.

FAQ (Frequently Asked Questions)

Can I move WSL distribution without shutting it down?

No, you must shut down any running distributions to avoid errors.

What happens to my data when I move a WSL distribution?

Your data will remain intact during the move. However, it’s always recommended to back up your data before the operation.