Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To shrink the Windows storage used by a WSL 2 distribution, first remove only unneeded data inside Linux, then shut WSL down and compact its VHDX if it is not already reclaiming space as a sparse file. Deleting Linux files alone may increase free space inside the distribution without reducing the VHDX’s physical allocation on Windows. Compaction can reclaim physical storage, but it does not necessarily reduce the disk’s maximum virtual capacity.

What “shrink” means for a WSL disk

Three different measurements matter, and they are not interchangeable:

  • Linux free space: space available to applications inside the distribution, which you can inspect with df -h /.
  • Windows physical allocation: the storage the VHDX currently occupies on the Windows drive. In File Explorer, compare the file’s logical size with Size on disk.
  • Maximum virtual capacity: the disk’s ceiling for how large it can grow. Microsoft’s current WSL disk-space documentation gives 1 TB as the default maximum for current WSL VHDs and notes historical defaults of 512 GB and 256 GB for earlier releases. These are virtual-capacity defaults, not the amount of Windows storage the VHDX consumes. See Microsoft’s WSL disk-space guide.

This procedure is about reclaiming Windows storage by reducing physical allocation. It is not a general method for lowering a VHD’s maximum virtual capacity. The WSL guide documents wsl --manage --resize for expansion in WSL 2.5 and later; it does not establish that command as a shrink operation.

Why a WSL VHDX may not get smaller after deleting files

WSL 2 stores a distribution in an ext4-formatted VHDX on the Windows host. When you delete files in Linux, the filesystem can report more free space while the VHDX still occupies the same amount on Windows. A dynamically expanding VHDX can retain its host allocation until unused blocks are compacted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
LAPGEAR Home Office Pro Lap Desk - Black Carbon, Fits 15.6” Laptops
  • Spacious Design: Measuring 21.1" wide and 14.1" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
  • Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy ergonomic support with the integrated cushioned wrist rest.
  • Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
  • Durable Surface: Work with confidence on our lap desk's solid surface, featuring a sleek black carbon color, ensuring optimal air circulation to prevent your laptop from overheating.
  • On-the-Go Convenience: With an integrated handle and lightweight design (2.8 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.

Sparse-file behavior can change that diagnosis: a sparse VHDX may deallocate storage within the file as blocks become unused. Microsoft documents sparse-file behavior generally, but current WSL sparse behavior is configuration-dependent; a community discussion is not a universal procedure. Check the actual VHDX’s sparse status and Size on disk before assuming compaction is needed. See Microsoft’s fsutil sparse documentation and the WSL community discussion.

Safely prepare the distribution

  1. Check Linux-side use. Open the intended distribution and run df -h /. This reports filesystem capacity and available space inside Linux; compare it with the Windows VHDX’s physical allocation rather than treating either number as a substitute for the other.
  2. Clean up known-unneeded data inside Linux. Use the package manager or application-specific cleanup appropriate to your distribution and workload. Avoid broad deletion commands: removing data still needed by Linux will not help, and Linux-side deletion does not by itself promise a smaller Windows allocation.
  3. Export important data before maintenance. From PowerShell or Command Prompt, use wsl --export <DistributionName> <FileName> to create an archive backup. WSL 2 also supports VHDX export with wsl --export <DistributionName> <FileName> --vhd. Check the distribution name with wsl --list --verbose and consult Microsoft’s WSL basic commands reference for export details.
  4. Stop WSL before host-side maintenance. Run wsl --shutdown. Microsoft uses this step in its disk maintenance guidance.
  5. Locate the correct VHDX. Identify the VHDX belonging to the distribution you intend to maintain using Microsoft’s registry-based lookup in the WSL disk-space guide. Do not guess based on a folder name or compact a different distribution’s disk.
  6. Check allocation and sparse state. Inspect the correct file’s Size on disk and sparse status. If Windows is already deallocating blocks and physical allocation is falling, additional compaction may not be necessary.

Microsoft warns against modifying, moving, or accessing WSL-related files under AppData with Windows tools or editors because doing so can corrupt a distribution. Use supported WSL commands and the documented disk tools; do not open or edit the VHDX contents directly.

Rank #2
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Choose a compaction tool for the VHDX state

For a non-sparse dynamically expanding VHD, Microsoft documents two relevant Windows tools. Both have disk-state requirements: the VHD must be detached or attached read-only for the selected operation. Shutting WSL down is important, but do not assume it alone satisfies every tool’s attachment requirements.

Option Availability Requirement and result
DiskPart compact vdisk DiskPart is available in Windows. The dynamically expanding disk must be detached or attached read-only. The command reduces physical size where reclaimable blocks are available; it does not establish a smaller maximum virtual capacity. See Microsoft’s compact vdisk reference.
Hyper-V Optimize-VHD Requires the Hyper-V PowerShell module to be available. The VHD must be detached or read-only. Full mode scans for zero blocks and reclaims unused blocks. The command can succeed without reducing file size if no optimization is possible. See Microsoft’s Optimize-VHD reference.

These are Microsoft-documented virtual-disk compaction tools, not a single universal WSL shrink command. Check the target VHDX’s state and follow the selected tool’s requirements rather than attaching or modifying it casually.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Yilador Webcam Cover 3 Pack, 0.03 inch Ultra Thin Laptop Camera Cover Slide
  • Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
  • 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
  • ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
  • ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
  • ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify whether Windows storage was reclaimed

After the operation, compare the same VHDX’s Size on disk with its pre-maintenance value. A smaller physical allocation means Windows storage was reclaimed. If the operation reports success but the physical allocation is unchanged, there may have been no reclaimable blocks; Microsoft explicitly notes this possibility for Optimize-VHD. A VHDX’s logical size or maximum virtual capacity alone does not show how much physical storage Windows recovered.

Best Value
Sale
LAPGEAR Home Office Lap Desk – Pink, Fits 15.6” Laptops
  • Spacious Design: Measuring 21.1" wide and 12" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
  • Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy laptop support with the integrated device ledge.
  • Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
  • Durable Surface: Work with confidence on our lap desk's solid surface, featuring a blush pink color, ensuring optimal air circulation to prevent your laptop from overheating.
  • On-the-Go Convenience: With an integrated handle and lightweight design (2.14 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
Rank #4
Sale
AboveTEK Portable Laptop Lap Desk w/Retractable Left/Right Mouse Pad Tray, Non-Slip Heat Shield Tablet Notebook Computer Stand Table w/Sturdy Stable Work Surface for Bed Sofa Couch or Travel
  • Anti-Slip Surface - Transform your laptop into a mobile workstation with the AboveTEK portable laptop lap desk. The anti-slip surface provides a strong grip for laptops up to 15.6 inches(Diagonal), while the double rubber strip on the bottom ensures a stable display or typing experience on your lap, couch, or bed.
  • Retractable Mouse Pad - Retractable laptop mouse pad extends on both directions for the left/right handed with elevation along the edges for stopping mouse from falling off. The size of laptop tray is 14" X 9.7" and the size of mouse pad is 7.4" X 6.1".
  • Effective Heat Shield - The effective heat shield made of sturdy and thick material protects your laptop from overheating. Prioritizes your comfort and safety, an ideal lap pad or board for working anywhere.
  • EASY to Carry and Store - With an ergonomic and simplistic design, the lap desk is portable to store in a backpack. Only 15" in size, 2.2 lb of weight and with slim 0.6 inch thickness, it is ready to be easily carried around.
  • Widely Applicable - The smooth platform accommodates laptops and tablets up to 15.6 inches(Diagonal), making it a versatile accessory and one of the best gifts for mom, dad, students and professionals. Perfect for use as a laptop bed tray or tablet holder anywhere at home, library, or park.

If the VHDX still occupies the same space

  • Linux still has little free space: the distribution may not have enough unused blocks to reclaim. Recheck df -h / and remove only data you know is no longer needed.
  • The VHDX is sparse: physical allocation may already be managed through sparse-file deallocation. Judge by the current Size on disk and configuration rather than applying a non-sparse workflow automatically.
  • The tool could not operate on the disk: verify that WSL is shut down, the selected VHDX belongs to the intended distribution, and the disk is detached or read-only as required by DiskPart or Hyper-V.
  • The tool completed but size did not change: there may be no optimizable blocks. Compaction is not guaranteed to yield a particular amount of reclaimed storage.

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.