Sparse VHD Support in WSL: Automatic Reclamation, Limits, and Safe Verification
How WSL ext4.vhdx allocation grows, what sparse mode and discard can reclaim, why deletion is not compaction, and how to back up, change, and verify safely.
tag
5 posts
How WSL ext4.vhdx allocation grows, what sparse mode and discard can reclaim, why deletion is not compaction, and how to back up, change, and verify safely.
When wsl --import-in-place is the right migration tool, how it differs from a tar import, and how to avoid registering your only copy of the disk.
Each WSL2 distro lives inside a dynamically-expanding .vhdx file that grows with use but never shrinks back down automatically after deletions.
Deleting files inside WSL2 does not shrink the Windows-side .vhdx automatically. That is expected dynamic-disk behavior, fixed with diskpart compaction.
A complete diskpart walkthrough for shrinking a WSL2 distro's .vhdx file after deleting large data, since Windows never reclaims that space on its own.