You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser.
vhdx compaction
About this tag
VHDX compaction is the process of shrinking dynamically expanding virtual hard disk files used by WSL 2, Docker Desktop, and Hyper-V on Windows. These VHDX files grow as data is added but do not automatically reclaim space when files are deleted, leading to significant disk bloat over time. The Windows diskpart command 'compact vdisk' is the primary tool for recovering this wasted space. Common scenarios include recovering disk space on a C: drive after extended use of Linux containers or virtual machines. Understanding when and how to compact VHDX files helps users maintain free storage without reinstalling or manually recreating virtual disks.
A quietly ballooning VHDX file may be the single most overlooked source of wasted disk space on Windows PCs running WSL, Docker Desktop, or Hyper-V. Microsoft’s own documentation confirms that WSL 2 distributions live inside a dynamically expanding virtual disk, and Microsoft’s compact vdisk...