Open PeterTucker opened 1 month ago
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
/question
Why does it not work?
@PeterTucker after wsl --manage <DISTRO_NAME> --set-sparse false
do a wsl --shutdown
again, and it should work.
Notice the FileSize
before and after running the command:
PS C:\Users\elsaco> Get-VHD -Path "G:\vms\sid\ext4.vhdx"
ComputerName : ELEVEN
Path : G:\vms\sid\ext4.vhdx
VhdFormat : VHDX
VhdType : Dynamic
FileSize : 1081081856
Size : 549453824000
MinimumSize :
LogicalSectorSize : 512
PhysicalSectorSize : 4096
BlockSize : 1048576
ParentPath :
DiskIdentifier : 40545B0A-6EE6-483B-AE7D-B64B4EF39DB1
FragmentationPercentage : 100
Alignment : 1
Attached : False
DiskNumber :
IsPMEMCompatible : False
AddressAbstractionType : None
Number :
PS C:\Users\elsaco> Optimize-VHD -Path "G:\vms\sid\ext4.vhdx" -Mode full
PS C:\Users\elsaco> Get-VHD -Path "G:\vms\sid\ext4.vhdx"
ComputerName : ELEVEN
Path : G:\vms\sid\ext4.vhdx
VhdFormat : VHDX
VhdType : Dynamic
FileSize : 1067450368
Size : 549453824000
MinimumSize :
LogicalSectorSize : 512
PhysicalSectorSize : 4096
BlockSize : 1048576
ParentPath :
DiskIdentifier : 40545B0A-6EE6-483B-AE7D-B64B4EF39DB1
FragmentationPercentage : 100
Alignment : 1
Attached : False
DiskNumber :
IsPMEMCompatible : False
AddressAbstractionType : None
Number
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
shows64gbs
Powershell(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