Getting Disks Space Back After Uninstalling Ubuntu 24.04 WSL2 on Windows 10

Abstract: Reclaim disk space by manually deleting the ext4.vhdx file after uninstalling Ubuntu WSL2 on Windows 10.

Created: 2026-08-04 by

Uninstalling Ubuntu from WSL2 does not automatically delete the underlying virtual hard disk file, leaving your Windows partition filled with gigabytes of unused data. To fully recover this space, you must manually locate and delete the ext4.vhdx file associated with the distribution. This process requires stopping the WSL service, identifying the correct file path, and removing it via File Explorer or PowerShell.

Why Disk Space Is Not Automatically Freed

When you remove an application like Ubuntu from the Microsoft Store or through the Windows Settings app, Windows only removes the shortcut and the registration metadata for that specific distribution. It does not touch the actual storage backend where the Linux filesystem resides. WSL2 uses a dynamically expanding virtual hard disk (VHDX) to store all Linux files, packages, and configurations. Even after the distribution is uninstalled, this VHDX file remains on your NTFS volume to prevent accidental data loss during potential reinstallation attempts. Consequently, your available disk space on Windows does not increase until this file is explicitly deleted.

Step 1: Stop All WSL Instances

Before deleting the disk file, you must ensure that no background processes are holding locks on it. The primary consumer of resources in WSL2 is the vmmem process, which represents the Linux VM. Simply closing terminal windows is often insufficient because the WSL daemon continues running in the background. Open PowerShell or Command Prompt as Administrator and execute the following command to shut down all active distributions:
wsl --shutdown
If you notice that vmmem is still consuming significant RAM or CPU in Task Manager after running this command, you may need to force-kill the process. Open Task Manager, find vmmem, right-click it, and select End Task. This ensures the virtual machine is completely powered off and releases any file handles attached to the VHDX. Ubuntu WSL Install Location: Where to Find It? provides additional context on how WSL manages its internal storage paths if you need further clarification on the architecture.

Step 2: Locate the VHDX File

The virtual disk file is typically stored in your user profile directory. The default location for WSL2 distributions is:
%LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu...\LocalState\ext4.vhdx
However, exact folder names can vary depending on the specific version of Ubuntu you installed (e.g., Ubuntu 22.04 vs Ubuntu 24.04). To find the precise path: 1. Open File Explorer and navigate to C:\Users\\AppData\Local\Packages. 2. Look for a folder starting with CanonicalGroupLimited. 3. Inside that folder, look for subfolders named after the distribution, such as 57968XGFBPBLK_... for Ubuntu. 4. Enter the LocalState folder within that distribution-specific folder. 5. You should see a file named ext4.vhdx. This is the file consuming your disk space. Note that the AppData folder is hidden by default. You can reveal it by clicking View > Show > Hidden items in File Explorer, or by typing %LOCALAPPDATA% directly into the address bar.

Step 3: Delete the Virtual Disk File

Once you have located the ext4.vhdx file, you can delete it to reclaim the space. Since you have already run wsl --shutdown, the file should not be in use. Right-click the ext4.vhdx file and select Delete. Move it to the Recycle Bin first to verify that your system is stable. If you do not encounter any errors, you can then empty the Recycle Bin. Alternatively, you can use PowerShell to delete it permanently:
Remove-Item "C:\Users\\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu...\LocalState\ext4.vhdx"
Replace the path with the actual path you identified in the previous step. After deletion, check your disk properties to confirm that the free space has been restored.

Preventing Future Accumulation

If you frequently experiment with different Linux distributions, consider using the wsl --unregister <DistroName> command before uninstalling via the Store. This command specifically targets the distribution's data and removes the associated VHDX file automatically. For example:
wsl --unregister Ubuntu
This approach is cleaner than manual deletion and reduces the risk of leaving orphaned files behind. It effectively wipes the state of the distribution, making it ready for a fresh install without carrying over old configurations or cached data.

Common Issues and Troubleshooting

Sometimes, users report that the space is not freed even after deletion. This can happen if the file was locked due to a lingering WSL process. Ensure that wsl --shutdown was successful and that no vmmem processes remain. Additionally, verify that you are deleting the correct file; some users confuse the rootfs.vhdx with other configuration files. Only ext4.vhdx contains the bulk of the data. Connecting to Ubuntu using ssh over Ethernet might be relevant if you plan to reinstall Ubuntu later and wish to access it remotely immediately after setup.

Frequently Asked Questions

Does deleting the VHDX file delete my Windows files?

No, the ext4.vhdx file is isolated within the WSL package directory and contains only Linux data. Deleting it will not affect your Windows operating system, personal documents, or other applications installed on your PC.

Can I shrink the VHDX file instead of deleting it?

Yes, if you want to keep the distribution but reduce its size, you can use the Optimize-VHD PowerShell cmdlet. However, this only shrinks the file if the guest OS has marked blocks as free. Manual deletion is more effective for complete recovery.

Why is vmmem still running after wsl shutdown?

Sometimes the WSL service hangs or fails to terminate cleanly. In such cases, restarting the Hyper-V Virtual Machine Management service via Services.msc or forcing a reboot of Windows will clear the stuck process and release the file lock.

Will reinstalling Ubuntu restore the deleted VHDX?

Reinstalling Ubuntu will create a new, fresh ext4.vhdx file. It will not restore the data from the previously deleted file. Your Linux environment will start from scratch with default settings and no previous packages or configurations.

How do I find the exact path if Canonical folders are missing?

If you used a custom installation method or a different provider, the path may differ. Use the wsl --list --verbose command to see registered distributions, and then check the registry under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss for the specific installation path associated with each GUID.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More