Skip to content

Portable WSL #12804

@YSYHZ

Description

@YSYHZ

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 <path> 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 and SuperUser since 2020

Conceptual workflow:

[USB Drive]  
├── distro.vhdx  
└── wsl-portable.json  # Metadata  

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions