Created
June 25, 2024 08:12
-
-
Save OmerFarukOruc/13b4291601b04c18e38f423f01050e04 to your computer and use it in GitHub Desktop.
To reclaim unused space on WSL2 images.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
wsl --shutdown | |
echo select vdisk file="C:\Users\Oruc\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx" > diskpart_script.txt | |
echo attach vdisk readonly >> diskpart_script.txt | |
echo compact vdisk >> diskpart_script.txt | |
echo detach vdisk >> diskpart_script.txt | |
diskpart /s diskpart_script.txt | |
del diskpart_script.txt | |
echo Done | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment