WSL and Docker ate your disk

WSL2 and Docker Desktop keep their Linux worlds inside virtual disk files - ext4.vhdx and docker_data.vhdx. These files grow on demand and never shrink on their own: delete 30 GB inside Linux, and Windows still sees the same huge file. On dev machines they are routinely the single largest objects on C:.

Find them first

They hide deep under AppData\Local\Packages (per-distro) and AppData\Local\Docker. On a disk map they are unmissable: one enormous file sector where system files should be small. In CleanMyWin the .vhdx icon marks them as disk images - if you see one at 80 GB, this article is for you.

Shrink them properly

First free space inside the VM (docker system prune -a inside Docker, delete junk inside the distro), then compact the file from Windows:

Keep it from happening again

Frequently asked

Why is ext4.vhdx so big after I deleted files in WSL?

The virtual disk grows on demand but does not return space to Windows by itself. Enable sparse mode or compact it with diskpart after wsl --shutdown.

Is it safe to delete docker_data.vhdx?

Only via Docker Desktop's own purge/reset - deleting the file by hand while Docker runs corrupts its state. You lose all local images and containers either way.

Sources and official documentation: Microsoft: Free up drive space in Windows, Microsoft: Storage Sense, Microsoft: WSL disk space, DaisyDisk, WizTree, WinDirStat, TreeSize

See where your terabytes went

One scan takes a minute. The first 24 hours are free.

Download for Windows

Write to us

We answer by email, usually within one business day.

Screenshots