WSL
WSL can be installed easily: wsl --install.
Note that drives are mounted, but access to files outside WSL can be slow, always copy files to WSL directly.
mount -l # what drives are mountedReclaim disk space
WSL also doesn’t automatically release space back to Local Hard drive. To release the disk space occupied by WSL follow this:
### Optimize (shrink) WSL 2 .vhdx
## Must be run in PowerShell as Administrator user
# DistroFolder found at: $env:LOCALAPPDATA\Packages\
# Examples:
# CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
# CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc
cd $env:LOCALAPPDATA\Packages\REPLACE_ME_WITH_TARGET_DISTRO_FOLDERNAME\LocalState\
wsl --shutdown
optimize-vhd -Path .\ext4.vhdx -Mode full
#Run `wsl` or your favorite terminal to resume useoptimize-vhd requires Hyperviser:
Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -OnlineLimit CPU memory usage
WSL can take a lot of CPU memory, to prevent this follow this, create /user/.wslconfig
[wsl2]
memory=6GB # set this line what you want to limit memory
swapFile=E:\\swap.vhdx # in case you need more memory specify swapping location with the hard drive, use double backslash
vmmem is the wsl2 process for CPU memory that you can observe in Task Manager.