Compact WSL partition and reclaim storage space

Start PowerShell

wsl --shutdown

Find where your WSL vhdx file is located. Usually under:

C:\Users\yourname\AppData\Local\Package\Linuxdistroflavour\LocalState\ext4.vhdx

Start diskpart (from PowerShell or CMD): diskpart.exe

Run:

select vdisk file="C:\Users\Jan van den Berg\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\ext4.vhdx"

and next:

compact vdisk

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *