WSL data is stored in two main places: the Linux filesystem for each distribution lives inside a virtual disk file (ext4.vhdx) under your Windows user profile, while files you access through /mnt/c are simply your existing Windows drives. In practice, that means your Ubuntu home folder, installed packages, and Linux-created files sit in a single growing virtual disk file on the Windows side, not in a separate hidden partition.
Background: What WSL Actually Is
Windows Subsystem for Linux (WSL) lets you run a real Linux environment directly on Windows without a traditional virtual machine window. There are two major versions. WSL 1 translated Linux system calls into Windows calls, so files lived on the Windows filesystem in a special folder. WSL 2 runs a real Linux kernel inside a lightweight virtual machine, which is why modern WSL distributions store their root filesystem inside a virtual hard disk. Most current installations use WSL 2, so the virtual disk layout is what you will encounter.
Each distribution you install — Ubuntu, Debian, Kali, and so on — gets its own separate virtual disk. They do not share a single root filesystem, though they can all reach the same Windows drives through the /mnt mount points.
Where the Linux Filesystem Lives
For distributions installed from the Microsoft Store or with the modern installer, the virtual disk is placed under your Windows user profile. The typical path looks like this:
- AppData\Local\Packages\<distribution package name>\LocalState\ext4.vhdx — the virtual disk holding the Linux root filesystem.
- The package folder name differs by distribution, so the exact folder is not identical for Ubuntu and Debian.
- If you installed WSL from an exported tarball or a custom location, the disk may sit wherever you chose during import.
You can confirm the location for any distribution from PowerShell by listing your installed distributions and then inspecting the registry entry for each one. The registry stores a BasePath value that points to the folder containing the virtual disk. This is the authoritative answer for your own machine, because custom imports and older installations can differ from the default.
Inside that virtual disk, the Linux side looks like a normal Linux system: /home/yourname for your files, /etc for configuration, /usr for programs, and /var for logs and caches. None of those paths exist as ordinary Windows folders; they exist only inside the disk image.
What /mnt/c Really Means
A common misconception is that WSL copies your Windows files into Linux. It does not. The /mnt/c, /mnt/d and similar paths are mount points that expose your actual Windows drives to Linux. A file you create at /mnt/c/Users/YourName/Documents/notes.txt is the same file Windows sees in your Documents folder. Deleting it in one place deletes it in the other.
This matters for performance and safety. Working directly in /mnt/c from Linux is slower than working inside the Linux filesystem, because every file operation crosses the boundary between the virtual machine and Windows. It also means Windows tools, backups, and antivirus can touch those files normally. Files inside the virtual disk, by contrast, are invisible to Windows unless you mount the disk or use the \\wsl$ network path.
Accessing Linux Files from Windows
You do not need to dig into AppData to reach your Linux files. From Windows Explorer, the address \\wsl$ opens a view of running distributions, and you can browse to home folders from there. From a Windows terminal, the same path works. This is the safe, supported way to move files between the two sides.
Editing Linux files with Windows applications through this path generally works, but some tools that expect Windows line endings or Windows permissions can cause problems. For development work, keeping source code inside the Linux filesystem and using the Linux toolchain is the smoother arrangement.
How the Virtual Disk Grows and Shrinks
The ext4.vhdx file starts small and grows as you install packages and create files. It does not automatically shrink when you delete data inside Linux, which surprises many users who wonder why their disk is still large after cleaning up. Reclaiming that space requires an explicit compaction step, usually by shutting down WSL, then using the disk management tools built into Windows or a supported compaction command. The exact procedure varies by Windows version, so check the official WSL documentation before running anything.
Because the disk is a single file, backing it up is straightforward in principle: export the distribution to a tarball, or copy the virtual disk while WSL is fully shut down. Copying it while WSL is running risks a corrupt image.
Common Problems and Fixes
- Disk filling up unexpectedly: the virtual disk grew and did not shrink. Compact it after shutting WSL down.
- Slow file operations: you are working under /mnt/c instead of the Linux home directory. Move the project into Linux storage.
- Permission errors on Windows files: Linux permissions do not map cleanly onto mounted Windows drives. Set the mount options or work inside the Linux filesystem.
- Cannot find the virtual disk: check the registry BasePath for that distribution rather than assuming the default folder.
- Distribution will not start after moving files: the virtual disk was moved or edited outside WSL. Restore from a backup or re-import it properly.
Choosing Where to Keep Your Project Files
The practical rule is simple: keep Linux-native work inside the Linux filesystem, and keep files you need to share with Windows applications on a Windows drive. A student writing code for a course should generally clone the repository inside the Linux home directory, because compilers, package managers, and file watchers behave far better there. Documents, spreadsheets, and media that other Windows programs open belong under /mnt/c or your normal Windows folders.
If you need a file in both worlds, copy it rather than symlinking across the boundary; cross-boundary links are fragile and confuse some tools.
Safety and Backup Considerations
Treat the virtual disk as the only copy of everything inside Linux. Windows backup tools may skip or mishandle files inside AppData, and a corrupted virtual disk can take the whole distribution with it. Exporting the distribution periodically is the reliable safeguard. Also remember that uninstalling a distribution from Windows can remove its data, so export first if anything matters.
Do not attempt to edit the virtual disk directly with Windows disk tools while WSL is running; that can corrupt the filesystem. Shut WSL down completely first.
Related
Frequently Asked Questions
Can I move the WSL virtual disk to another drive? Yes, by exporting the distribution and importing it to a new location, or by using the supported move options in current Windows versions. Follow the official documentation, because the exact commands and available options differ between Windows releases.
Does uninstalling a WSL distribution delete my files? It can. The distribution’s virtual disk is tied to the installation, so export anything important before removing it. Reinstalling gives you a fresh environment, not your old files.
Why is my WSL disk so large after I deleted files? The virtual disk does not shrink automatically. You must compact it after shutting WSL down. Until then, the space stays allocated even though Linux reports free space.
Where are my Linux files in Windows Explorer? Use the \\wsl$ path to browse a running distribution. The underlying virtual disk in AppData is not meant to be opened directly.
Is it safe to back up the ext4.vhdx file by copying it? Only while WSL is fully shut down. Copying a live disk can produce a corrupt backup that will not start.
Do all WSL distributions share one disk? No. Each installed distribution has its own virtual disk and its own filesystem, though all can access the same Windows drives through /mnt.