https://github.com/pforret/wslmgt
Check and shrink WSL disk usage
https://github.com/pforret/wslmgt
bashew wsl2
Last synced: 7 months ago
JSON representation
Check and shrink WSL disk usage
- Host: GitHub
- URL: https://github.com/pforret/wslmgt
- Owner: pforret
- License: mit
- Created: 2024-10-04T13:07:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-04T14:32:27.000Z (about 1 year ago)
- Last Synced: 2025-03-18T21:55:12.472Z (7 months ago)
- Topics: bashew, wsl2
- Language: Shell
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wslmgt
Check and shrink WSL disk usage## Usage
```
Program : wslmgt by peter@forret.com
Version : v0.0.0 (2024-10-04 15:15)
Purpose : list and manage wsl volumes
Usage : wslmgt [-h] [-Q] [-V] [-f] [-L ] [-T ]
Flags, options and parameters:
-h|--help : [flag] show usage [default: off]
-Q|--QUIET : [flag] no output [default: off]
-V|--VERBOSE : [flag] also show debug messages [default: off]
-f|--FORCE : [flag] do not ask for confirmation (always yes) [default: off]
-L|--LOG_DIR > : [option] folder for log files [default: /home/pforret/log/wslmgt]
-T|--TMP_DIR > : [option] folder for temp files [default: /tmp/wslmgt]
: [choice] action to perform [options: list,action2,check,env,update]
: [parameter] input file/text (optional)
```## wslmgt list
```bash
$ wslmgt list
⏳ WSL Volumes: actual size on disk
56G : Ubuntu20.04 : ext4.vhdx : [windows user]
28G : Ubuntu22.04 : ext4.vhdx : [windows user]
⏳ WSL Images : used disk space
41G : Ubuntu-20.04 : /dev/sdf: [wsl user]
28G : Ubuntu-22.04 : /dev/sde: [wsl user]
✴️: Ubuntu-24.04 is WSL1: no VHDX disk that can be shrunk
```## wslmgt shrink
```bash
$ wslmgt shrink
# Run the following in a Powershell (Run As Administrator):
# (don't type the '>' and whatever's in front of it, your Powershell will show this)
PS C:\WINDOWS\system32> wsl.exe --shutdownPS C:\WINDOWS\system32> diskpart
DISKPART> select vdisk file=c:\Users\[user]\AppData\Local\Packages\[...Ubuntu20.04LTS_...]\LocalState\ext4.vhdxDiskPart successfully selected the virtual disk file.
DISKPART> compact vdisk
100 percent completed
DiskPart successfully compacted the virtual disk file.DISKPART> exit
```