Where is wsl stored
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 17, 2026
Key Facts
- WSL 2 stores Linux distributions in a virtual hard disk using the VHDX format
- The default WSL storage path is %LOCALAPPDATA%\Packages\<distro-package>\LocalState\ext4.vhdx
- WSL 1 does not use a virtual disk and instead translates Linux system calls directly
- Each Linux distribution installed via Microsoft Store gets its own isolated storage container
- WSL 2 uses a lightweight utility VM with a Linux kernel provided by Microsoft
Overview
Windows Subsystem for Linux (WSL) allows users to run a Linux environment directly on Windows without dual-booting or using a virtual machine. Since its initial release in 2016, WSL has evolved significantly, especially with the introduction of WSL 2 in 2019, which uses a real Linux kernel for improved compatibility and performance.
One of the most common questions users have is where WSL stores its files and system data. Understanding the storage structure is crucial for managing disk space, backing up distributions, and troubleshooting file access issues between Windows and Linux environments.
- WSL 2 stores each installed Linux distribution in a virtual hard disk (VHDX) file, which behaves like a real disk partition and is managed by Hyper-V.
- The default storage path for WSL 2 distributions is %LOCALAPPDATA%\Packages\<distro-package>\LocalState\ext4.vhdx, where <distro-package> corresponds to the specific Linux distribution.
- For example, Ubuntu installed from the Microsoft Store uses a package name like CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc, which determines the exact folder path.
- WSL 1 does not use a virtual disk; instead, it translates Linux system calls into Windows NT kernel calls, storing files directly in a hidden folder under AppData.
- Users can access WSL files from Windows using the \wsl$\<distro-name> network path, such as \wsl$\Ubuntu-20.04, for easy file transfer.
How It Works
WSL integrates Linux into Windows through a combination of kernel-level translation and virtualization, depending on the version. The storage mechanism differs significantly between WSL 1 and WSL 2, impacting how files are stored, accessed, and managed.
- Virtualization Layer: WSL 2 runs a lightweight utility virtual machine using Hyper-V, which hosts a real Linux kernel and a full ext4 file system inside a VHDX file.
- VHDX File: The virtual hard disk is dynamically expanding, starting small but growing up to 256 GB by default, though this limit can be adjusted by the user.
- File Access: While WSL can access Windows files via /mnt/c, accessing Linux files from Windows requires navigating to the WSL network path or using WSL command-line tools.
- Storage Isolation: Each Linux distribution runs in its own container with a separate VHDX file, preventing interference between distributions like Ubuntu, Debian, or Kali Linux.
- Performance Impact: Because WSL 2 uses a virtual disk, file I/O operations between Windows and Linux can be slower than native Linux, especially for large projects in the Windows file system.
- Backup and Migration: Users can back up or move a WSL distribution by exporting it using wsl --export, which creates a tarball of the entire file system.
Comparison at a Glance
The following table outlines key differences in storage and architecture between WSL 1 and WSL 2:
| Feature | WSL 1 | WSL 2 |
|---|---|---|
| Storage Method | Translates Linux system calls | Uses a virtual hard disk (VHDX) |
| File System | NTFS-backed, no real Linux file system | ext4 inside a virtual disk |
| Disk Location | %LOCALAPPDATA%\Packages\...\LocalState | %LOCALAPPDATA%\Packages\...\LocalState\ext4.vhdx |
| Performance (I/O) | Faster for Windows file access | Slower for cross-OS file access |
| Kernel | Windows NT translation layer | Real Linux kernel (from Microsoft) |
These differences explain why WSL 2 offers better compatibility with Linux applications but introduces complexity in file management. Users working primarily in Linux directories benefit from WSL 2’s full system call compatibility, while those frequently accessing files from Windows may prefer WSL 1 for speed.
Why It Matters
Understanding where and how WSL stores data is essential for developers, system administrators, and power users who rely on Linux tools within Windows. Mismanagement of WSL storage can lead to high disk usage, slow performance, or data loss during updates.
- Disk Space Monitoring: The VHDX file can grow large, so users should monitor ext4.vhdx size and use wsl --shutdown to compact it when needed.
- Data Recovery: If a distribution becomes corrupted, users can recover files by mounting the VHDX manually or using backup exports.
- Multiple Distributions: Each installed distro uses its own storage, so installing several can consume significant space—Ubuntu alone can use over 5 GB initially.
- Cloud Integration: WSL integrates with tools like Docker Desktop and VS Code, making storage location awareness critical for container and project management.
- Security: The isolation of WSL file systems enhances security, preventing accidental modification of Windows system files from Linux.
- Migration: Users switching computers can transfer WSL environments using wsl --export and wsl --import, preserving custom configurations and data.
As WSL continues to evolve with features like GPU support and systemd integration, understanding its underlying storage architecture ensures users can leverage its full potential while avoiding common pitfalls.
More Where Is in Daily Life
Also in Daily Life
More "Where Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- WikipediaCC-BY-SA-4.0
Missing an answer?
Suggest a question and we'll generate an answer for it.