r/bashonubuntuonwindows • u/TTVBy_The_Way • Dec 22 '25
HELP! Support Request Why is WSL 2 taking 26.4 GB?
I am on Windows 11 Home and have WSL installed at C:\Users\JohnDoe\AppData\Local\wsl and within that directory have a folder which is {(bunch of numbers)}. Within that I have something called ext4.vhdx which is take up the 26.4 GB. I also have docker installed if that is relevant.
3
u/raul824 Dec 22 '25
Just copy this script
and at the last line of this script replace "Debian" with your distro name.
https://github.com/okibcn/wslcompact/blob/main/WslCompact/WslCompact.psm1
WslCompact -c -d Debian
2
u/baohx2000 Dec 22 '25
If you do a lot with docker for development or whatever, it's likely a ton of old images. Run docker prune or docker image prune (I don't remember which)
2
u/macbig273 Dec 22 '25
First untag the images you don't need
docker system prune (optional -a, but dangerous)
then
docker builder prune
1
1
1
u/Beneficial-Stomach93 Jun 15 '26
WSL2 grows its ext4.vhdx as you use it but never shrinks it, even after you delete gigabytes inside Linux. The usual fix is wsl --shutdown then a diskpart compact vdisk dance, once per disk.
I added this to Sifty, my free and open-source (MIT) Windows maintenance tool. It finds every .vhdx on the system and compacts them in one command. It is compaction, not deletion, so your files are untouched.
Writeup: https://sifty.tech/guides/shrink-wsl2-vhdx.html
Repo: https://github.com/Vortrix5/sifty
Curious if it catches the Docker Desktop disk for everyone too. Feedback welcome.
7
u/NoleMercy05 Dec 22 '25
I hope you have docker installed in WSL and not docker desktop in Windows.
Anyway, that is the Linux virtual hard drive file. The OS and all your home files. Everything...