microsoft / microsoft/WSL

Portable WSL

Open
#12,804 3 comments 2 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Is your feature request related to a problem? Please describe
The current WSL import/export workflow forces users to install distributions onto local disks. This creates two key limitations:
1. **Lack of true portability** - Developers cannot maintain self-contained WSL environments on removable drives
2. **Host system contamination** - Temporary usage on foreign computers leaves persistent installations and user data traces

---

### Describe the solution you'd like
Implement a portable execution mode where:
1. `wsl --import` accepts external storage paths (e.g. `\\?\Volume{UUID}\wsl_distro`)
2. Distributions run directly from removable media without disk writes
3. Automatic cleanup upon ejection (no registry/Appx残留)

**Technical implementation could involve:**
- Extended VHDX mounting from removable drives
- Transient profile/tempfile redirection to external storage
- New `wsl --mount-removable ` command

---

### Describe alternatives you've considered
1. **Manual export/import workflows**
- Still requires local disk staging (time-consuming)
- Leaves temporary files in `%USERPROFILE%\AppData`
2. **Portable Virtual Machines**
- Heavy performance overhead (full VM vs lightweight WSL2)
- Complex USB boot configurations required

---

### Additional context
- **Verified on**: Windows 11 22H2 (WSL 1.2.5) - Standard import always writes to local disk
- **Prior research**: No existing workarounds using `wsl.conf` or registry edits
- **Community demand**: Similar requests observed on [Reddit](https://www.reddit.com/r/bashonubuntuonwindows/) and [SuperUser](https://superuser.com/) since 2020

**Conceptual workflow**:
```shell
[USB Drive]
├── distro.vhdx
└── wsl-portable.json # Metadata

> wsl --mount-removable E:\wsl\ --distro PortableEnv

Contributor guide

Open the contributing guide

Research direction

Start with the existing `wsl --import` workflow and the proposed `wsl --mount-removable` command. The issue names no source files or tests, so first map the relevant command, storage, VHDX, and cleanup paths. Done would require portable execution from removable storage without local persistence, registry/Appx residue, or host-user data traces.

Written by the indexing model from the issue text.

Assessment

Domain
cli, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.