Windows Version
Microsoft Windows [Version 10.0.19045.4894]
WSL Version
2.2.4.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.153.1-microsoft-standard-WSL2
Distro Version
Ubuntu 22.04
Other Software
No response
Repro Steps
Sparse does not work.
Ubuntu disk space (.vhdx file) shows 118gbs in windows 10.
In Ubuntu: /ncdu / --exclude /mnt shows 64gbs
Powershell(admin): notepad "$env:USERPROFILE/.wslconfig"
.wslconfig:
[experimental]
sparseVhd=true
Powershell(admin):
wsl --list # list distros
wsl --manage <distro> --set-sparse true # enable sparse on vdisk
wsl --shutdown # restart wsl
wsl # restart wsl
Then when I check the size, it has not changed at all, still 118gbs.
SOLUTION (MANUAL SHRINKING):
for anyone who finds this in the future. Here is a way to resize the disk manually.
Powershell (admin):
FIRST BACKUP YOUR VHDX FILE
wsl --list # list distros
wsl --shutdown # Be patient and wait a bit for wsl to shutdown. It will eventually shutdown.
wsl --manage <DISTRO_NAME> --set-sparse false
optimize-vhd -Path "<VHDX_FILE>" -Mode full
wsl --manage <DISTRO_NAME> --set-sparse true
Then test if the VHDX file (wiztree) has shrunk and your distro can run.
Expected Behavior
Reclaim disk space in Windows 10.
Actual Behavior
The sparseVhd setting does not reclaim disk space in Windows 10.
Diagnostic Logs
No response
Windows Version
Microsoft Windows [Version 10.0.19045.4894]
WSL Version
2.2.4.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.153.1-microsoft-standard-WSL2
Distro Version
Ubuntu 22.04
Other Software
No response
Repro Steps
Sparse does not work.
Ubuntu disk space (.vhdx file) shows
118gbsin windows 10.In Ubuntu:
/ncdu / --exclude /mntshows64gbsPowershell(admin):
notepad "$env:USERPROFILE/.wslconfig".wslconfig:
Powershell(admin):
Then when I check the size, it has not changed at all, still
118gbs.SOLUTION (MANUAL SHRINKING):
for anyone who finds this in the future. Here is a way to resize the disk manually.
Powershell (admin):
Then test if the VHDX file (wiztree) has shrunk and your distro can run.
Expected Behavior
Reclaim disk space in Windows 10.
Actual Behavior
The sparseVhd setting does not reclaim disk space in Windows 10.
Diagnostic Logs
No response