Recommended Free Tools
Deleting files inside WSL2 does not necessarily reduce the space its ext4.vhdx file occupies on Windows. The Linux filesystem’s used space, its virtual capacity, and the VHDX’s physical size are different measures. To reclaim host storage, identify the correct distribution disk, shut down WSL, then compact the detached VHDX with a supported Windows tool.
Why deleting Linux files may not free Windows storage
A WSL2 distribution stores its Linux filesystem in a virtual hard disk. A dynamically expanding VHDX grows as data is written, but deleting files inside Linux does not automatically shrink the file on the Windows host. The freed blocks may remain allocated within the virtual disk until a compaction operation can reclaim them.
As an Amazon Associate I earn from qualifying purchases.
Keep three measurements separate:
- Linux filesystem usage: how much space files currently use inside the distribution.
- Virtual capacity: the maximum size the guest filesystem can use. Microsoft says recent WSL versions present a 1 TB default maximum, while earlier releases may show 512 GB or 256 GB. These are virtual-capacity defaults, not the size of the Windows file.
- VHDX physical size: the storage the disk file actually occupies on Windows. This is the figure compaction may reduce.
Microsoft’s WSL disk-space documentation gives this command for checking the guest filesystem view: wsl.exe --system -d <distribution-name> df -h /mnt/wslg/distro. It reports filesystem information, not the VHDX’s physical allocation on Windows.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchFind the right distribution disk
Do not guess the path or select a disk based only on a familiar filename: a machine can have multiple distributions, each with its own virtual disk. Microsoft documents querying the distribution registry entries to find a distribution’s BasePath, then appending ext4.vhdx. Run this in PowerShell, replacing the name with the exact distribution name shown by wsl.exe --list --quiet:
#1 Best Overall
- Capacity Display Variance: 1TB external ssd often appears as around 931GB on Windows. MacOS can show full 1 TB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
- 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
- Data Security: Solid state drives S.M.A.R.T. health diagnostics and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
- USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
- Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
$distro = 'Ubuntu'
$lxss = 'HKCU:SoftwareMicrosoftWindowsCurrentVersionLxss'
$entry = Get-ChildItem $lxss | Where-Object {
(Get-ItemProperty $_.PSPath).DistributionName -eq $distro
}
$basePath = (Get-ItemProperty $entry.PSPath).BasePath
$vhd = Join-Path $basePath 'ext4.vhdx'
$vhd
Check that the returned path belongs to the intended distribution before running any disk operation. Microsoft warns that modifying, moving, or accessing WSL files in AppData with ordinary Windows tools or editors can corrupt the distribution. Preserve important distribution data before doing offline disk work; Microsoft’s documentation does not prescribe one universal backup procedure.
Compact the VHDX to reclaim host storage
Compaction concerns the file’s physical allocation, not the guest’s virtual maximum capacity. Shut down WSL before operating on the VHDX. Microsoft documents both Hyper-V PowerShell and DiskPart approaches.
Rank #2
- 【Plug-and-Play Expandability】 With no software to install, just plug it in and the drive is ready to use in Windows(For Mac,first format the drive and select the ExFat format.
- 【Fast Data Transfers 】The external hard drives with the USB 3.0 cable to provide super fast transfer speed. The theoretical read speed is as high as 110MB/s-133MB/s, and the write speed is as high as 103MB/s.
- 【High capacity in a small enclosure 】The small, lightweight design offers up to 500GB capacity, offering ample space for storing large files, multimedia content, and backups with ease. Weighing only 0.35 Lbs, it's easy to carry "
- 【Wide Compatibility】Supports PS4 5/xbox one/Windows/Linux/Mac and other operating systems, ensuring seamless integration with game consoles,various laptops and desktops .
- Important Notes for PS/Xbox Gaming Devices: You can play last-gen games (PS4 / Xbox One) directly from an external hard drive. However, to play current-gen games (PS5 / Xbox Series X|S), you must copy them to the console's internal SSD first. The external drive is great for keeping your library on hand, but it can't run the new games.
- Stop all WSL instances. In PowerShell, run
wsl.exe --shutdown. This terminates all running WSL distributions. - Choose a compaction method. Use
Optimize-VHDif the Hyper-V PowerShell module is available, or DiskPart if you prefer the built-in command-line route. - Run compaction against the verified path. Use the appropriate command below. Follow the tool’s disk-state requirements: the VHD must be detached or read-only, and
Optimize-VHD -Mode Fullspecifically requires read-only access. - Check the Windows-side file size. Compare the VHDX’s physical size before and after. The Linux-visible maximum capacity is not expected to change.
Option 1: Optimize-VHD
In an elevated PowerShell session with the Hyper-V module installed, run:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Optimize-VHD -Path $vhd -Mode Full
The Optimize-VHD documentation says the disk must be detached or read-only. Full scans for zero blocks and reclaims unused blocks, but it is allowed only when the disk is read-only. The cmdlet also offers Prezeroed, which can be used when the disk is detached but cannot query internal NTFS free-space information, and may be less effective. The appropriate mode depends on disk state; consult Microsoft’s documentation for the exact requirements.
Rank #3
- Built for Creators: Capture, edit, and transfer with ease. NVMe SSD with premium NAND Flash delivers up to 2100MB/s—perfect for 4K video, RAW photos, and gaming assets
- Record Without Limits: Direct 4K 120fps HDR recording from compatible USB-C iOS/Android phones, cameras, and tablets with supported pro apps. Ideal for high-bitrate shooting on the go
- Rugged, Reliable, Ready: Durable aluminum shell with water- and drop-proof protection. SMART monitoring and advanced error correction keep your data safe in any environment
- Works Where You Do: True plug-and-play with laptops, desktops, cameras, projectors, and more. Fully compatible with Windows, Mac, iPad Pro, Chromebooks, Android, Linux, PS4, PS5, and Xbox devices
- Pocket-Sized Power & Capacity Notice: Ultra-slim 2.85 × 1.52 × 0.40 in, 0.03 lb SSD fits any pocket or gear bag. Actual usable storage may be ~7–10% less than labeled due to system calculation differences. Supports up to 2100MB/s under ideal USB 3.2 Gen 2x2/Thunderbolt 4/5 conditions; older interfaces may reduce speeds
A successful command does not guarantee a smaller file: Microsoft notes that optimization can complete without reducing the VHDX size when no optimization is possible.
Option 2: DiskPart compact vdisk
In an elevated Command Prompt or PowerShell, start DiskPart and select the verified VHDX:
Rank #4
- Note: Magsafe is not available in this version
- High-speed Data Transfer: Lexar external SSD ES3 supports USB 3.2 Gen 2 up to 1050MB/s read and 1000MB/s write to transfer files fast for more efficient work. (Performance may be lower if not supporting USB 3.2 Gen 2 on Mac and other systems)
- Wide Compatibility: Lexar Portable SSD ES3 compatibility with iPhone 17 series (Not supported on iPhone 14 and older models), Android mobile devices, laptops, cameras, Xbox X|S, PS4, PS5, gaming console, and more
- On The Go: Lexar external solid state drive ES3's thin, stylish, and durable design, weighs 42g and is only 10.5mm thick, making it smaller than a card and easily fits in your pocket. It comes with a Type-C cable for plug-and-play convenience
- Data Safety First: Lexar SSD ES3 includes Lexar DataShieldTM 256-bit AES encryption software to protect files
diskpart
At the DiskPart prompt, run:
select vdisk file="C:pathtoext4.vhdx"
compact vdisk
exit
Replace the example path with the path you verified for the intended distribution. Microsoft’s DiskPart compact vdisk documentation says the selected dynamically expanding VHD must be detached or read-only. This command reduces the VHD’s physical size; it does not change its virtual capacity.
Which operation does what?
| Operation | What it changes | Key condition or distinction |
|---|---|---|
Optimize-VHD |
Compacts eligible dynamic or differencing VHD files by reclaiming unused blocks and repacking allocation. | Disk must be detached or read-only; success may not reduce file size. Microsoft documentation |
DiskPart compact vdisk |
Reduces the physical size of a dynamically expanding VHD. | Selected disk must be detached or read-only. Microsoft documentation |
DiskPart shrink |
Shrinks a selected supported filesystem volume using free space at its end. | It is a volume operation, not a way to compact the Windows VHDX file. Microsoft lists NTFS or filesystem-free volumes among supported cases. Microsoft documentation |
Resize-VHD |
Changes a virtual disk’s maximum capacity. | It does not remove empty blocks from a dynamically expanding disk; Microsoft directs users to Optimize-VHD for that purpose. Microsoft documentation |
Can WSL shrink the disk automatically?
Microsoft’s September 18, 2023 WSL update described sparse VHD as an experimental feature that automatically shrinks a WSL virtual disk. In that post, the sparseVhd setting defaulted to false and applied automatically to newly created VHDs when enabled. The post also documented wsl --manage <distro> --set-sparse <true/false> for existing distributions. Craig Loewen, then a Microsoft Principal Product Manager, wrote that “WSL virtual hard disks (VHDs) grow in size as you use them, and now with this feature enabled they will automatically shrink in size too!”
Best Value
- Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
- 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
- Data Security: Solid state drives S.M.A.R.T. health diagnostics and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
- USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
- Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
That statement describes the feature as presented in 2023; it does not establish availability or behavior on every current Windows and WSL combination. Check the September 2023 WSL update and current WSL configuration documentation for your installed release before relying on automatic reclaim. The cited feature description does not establish a reclaim schedule or a guaranteed amount of space saved.
If the VHDX is still large afterward
- Confirm you checked the host file. Linux filesystem usage and virtual capacity do not show the VHDX’s physical Windows allocation.
- Verify the distribution and path. Make sure the file you compacted belongs to the distribution you intended.
- Check the disk state and selected mode. The compaction tool’s detached/read-only requirements must be met;
Fullhas the stricter read-only requirement. - Expect that there may be nothing reclaimable. A successful
Optimize-VHDoperation may leave the file size unchanged. - Do not substitute volume shrinking or capacity resizing. DiskPart
shrinkoperates on a filesystem volume, whileResize-VHDchanges virtual capacity rather than reclaiming empty blocks.
For additional WSL disk operations, including capacity expansion, see Microsoft’s disk-space guide. Microsoft’s current documentation says wsl --manage --resize requires WSL 2.5 or later; that command changes virtual capacity and is not a compaction method.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems




