If you have been using WSL 2 and Docker Desktop for some time, you might notice a significant consumption of your drive space.
I have come across two threads that discuss this issue:
To address the issue of drive space consumption related to the .vhdx file in WSL, you can consider limiting the space allocation or manually shrinking the file as needed. Here’s a step-by-step guide:
- Open PowerShell as an administrator.
- Type the following command to shut down the WSL instance .
- Execute the following command to optimize and shrink the .vhdx file
Optimize-VHD -Path .\ext4.vhdx -Mode Full
Replace.\ext4.vhdx
By running these commands, you can effectively optimize and shrink the .vhdx file associated with WSL, helping to free up drive space on your system.
In threads, someone also mentioned there is a tool can help, but I haven’t tried.
搶先發佈留言