Created
May 2, 2024 20:23
-
-
Save earentir/71a90cdf02acafdeb1ca7658f903c4fd to your computer and use it in GitHub Desktop.
Compact WSL VHDX
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
## make sure its down | |
wsl --shutdown | |
## export for backup | |
wsl --export Fedora S:\Backup\wsl-fedora40-compact.vhdx | |
## make sure its not mounted by the OS | |
Dismount-DiskImage -ImagePath 'C:\distros\Fedora\ext4.vhdx' | |
## make sure its not sparse | |
wsl --manage Fedora --set-sparse false | |
## run optimize | |
Optimize-VHD -mode full C:\distros\Fedora\ext4.vhdx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment