Skip to content

Instantly share code, notes, and snippets.

@marhensa
Last active August 28, 2023 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marhensa/e295e443d0ae4e4104c99912be3abca7 to your computer and use it in GitHub Desktop.
Save marhensa/e295e443d0ae4e4104c99912be3abca7 to your computer and use it in GitHub Desktop.
Compacting Virtual HD of WSL (VHDX)
# Without Hyper-V Enabled
# Powershell (As Administrator)
wsl --shutdown
diskpart
# Diskpart Compacting Operations
select vdisk file="E:\LABS\DockerWSL\docker-desktop-data\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit
# With Hyper-V Enabled
# Powershell (As Administrator)
Optimize-VHD -Path "E:\LABS\DockerWSL\docker-desktop-data\ext4.vhdx" -Mode Full
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment