Changing the Location of WSL Installation on Windows 10
Jump to navigation
Jump to search
- From a local Ollama LLM summarizing a 'superuser.com' comments page
If you're looking to modify the installation location of the Windows Subsystem for Linux (WSL) on your Windows 10 PC, here's what you need to know.
Understanding WSL Components
It's essential to grasp that WSL encompasses multiple components, each with its own characteristics regarding relocation:
wsl.exe Command: This is integral to Windows and cannot be installed or uninstalled separately. It resides within the system32 directory by default.
Base WSL ("lxss"): Installed as a Windows Feature, it occupies a small disk space and cannot be uninstalled but can be enabled or disabled.
WSL2 Virtual Machine Platform: Another Windows Feature, its location cannot be altered.
WSL2 Linux Kernel: Installed alongside other WSL binaries, its directory can't be changed, but you can relocate it manually and update the configuration.
WSL Distributions: Installed in the user's profile directory by default, they can be exported, moved, and imported.
Options for Relocation
Depending on your objective, you can consider these approaches:
Moving Specific Distributions:
Use commands like wsl --terminate, wsl --unregister, and wsl --import-in-place to swiftly relocate a specific distribution to a new location. Changing Default Installation Location: To change the default location of WSL distributions, navigate to Windows Settings > Apps > Installed Apps, find your desired distribution, click the three-dot icon, and select "Move" to relocate it to your preferred location.
- Important Considerations
Remember that while you can move distributions, you can't alter the default location of critical system components like the WSL2 Virtual Machine Platform. If storage space is a concern, consider relocating your entire Windows installation, as moving WSL components individually might not provide significant benefits. By understanding the intricacies of WSL components and utilizing the appropriate methods, you can effectively manage the installation location of WSL on your Windows 10 system.