You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compacts the size of the WSL images by removing unused empty space.
FEATURES
The Windows Subsystem for Linux (WSL) uses VHDX image files to store the ext4 filesystem, but it lacks an effective way to shrink the image when the files are removed. This utility compacts the vhdx virtual images of the WSL2 distros. It achieves the minimum possible size. The program provides the following info for each installed distro:
Name
image file location
Current size of the image file
Estimated compacted size
By default it will perform in compact mode. and if no distro is specified, it will compact all the installed images sequentially providing also the info about the resulting compacted size.
The usage is straightforward. Calling wslcompact without arguments compacts all the WSL images. Or you can compact a single one passing its name as an argument, for instance wslcompact Ubuntu. It ensures a minimal size and you end up with contiguous files for faster access in old HD-based systems. The list of names of the installed distros is accessible by typing wsl -l in any powershell terminal. with the -i info mode, it wont compact the images providing only the info.
Usage: wslcompact [OPTION] [DISTROS] compacts the image file of the DISTROS. If no distro is provided it will compact all the images. Options: -i run in info mode, providing data without compacting. -h prints this help Examples: wslcompact wslcompact -i wslcompact Ubuntu Kali
if your C: drive doesn't have enough temporal free space, the program won't compact that distro. Just change the TEMP folder before calling the function. So, instead of a simple wslcompact, just do:
$env:TEMP="Z:\your temp\folder" wslcompact
The new TEMP folder will be active only for that PowerShell terminal session, so no problem at all for the rest of the system and it won't leave garbage.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
WSLCOMPACT
Compacts the size of the WSL images by removing unused empty space.
FEATURES
The Windows Subsystem for Linux (WSL) uses VHDX image files to store the ext4 filesystem, but it lacks an effective way to shrink the image when the files are removed. This utility compacts the vhdx virtual images of the WSL2 distros. It achieves the minimum possible size. The program provides the following info for each installed distro:
By default it will perform in compact mode. and if no distro is specified, it will compact all the installed images sequentially providing also the info about the resulting compacted size.
INSTALLATION
The easier way to install nano is by using Scoop package manager.
To remove the app just type:
> scoop uninstall wslcompactUSAGE
The usage is straightforward. Calling
wslcompactwithout arguments compacts all the WSL images. Or you can compact a single one passing its name as an argument, for instancewslcompact Ubuntu. It ensures a minimal size and you end up with contiguous files for faster access in old HD-based systems. The list of names of the installed distros is accessible by typingwsl -lin any powershell terminal. with the-iinfo mode, it wont compact the images providing only the info.if your C: drive doesn't have enough temporal free space, the program won't compact that distro. Just change the TEMP folder before calling the function. So, instead of a simple
wslcompact, just do:The new TEMP folder will be active only for that PowerShell terminal session, so no problem at all for the rest of the system and it won't leave garbage.
Beta Was this translation helpful? Give feedback.
All reactions