Fix "No space left on device" Error in WSL
wsl.exe --shutdown
(Get-ChildItem -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | Where-Object { $_.GetValue("DistributionName") -eq '<distribution-name>' }).GetValue("BasePath") + "\ext4.vhdx"
replace <distribution-name>
with the actual distribution name.
Example: Ubuntu-20.04
diskpart
Select vdisk file="<pathToVHD>"
replace <pathToVHD>
with the actual path to the VHD.
Example: C:\Users\User\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
detail vdisk
expand vdisk maximum=<sizeInMegaBytes>
replace <sizeInMegaBytes>
with the actual size in MegaBytes.
Example: 512000
exit