Files
LogSeq/pages/Scripts/How to Shrink a WSL2 Virtual Disk – SCRIPT.md
2025-12-11 06:26:12 -08:00

21 lines
536 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
title:: How to Shrink a WSL2 Virtual Disk SCRIPT
updated:: 2022-10-17 18:47:57+00:00
created:: 2022-10-17 18:47:57+00:00
source:: https://stephenreescarter.net/how-to-shrink-a-wsl2-virtual-disk/
just put the in the flle scriptname.txt the lines
```batch
wsl.exe terminate WSLinux
wsl shutdown
select vdisk file=%appdata%\\..\\Local\\Local\\Packages\\SomeWSLVendorName\\LocalState\\ext4.vhdx
compact vdisk
exit
```
Create a task in task scheduler with this action
`diskpart /s PathToScript\\scriptname.txt > logfile.txt`