跳至主要內容

Deal with huge ext4.vhdx (WSL 2 / Docker Desktop) on Windows 11

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:

  1. GitHub Thread
  2. Stack Overflow Thread

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:

  1. Open PowerShell as an administrator.
  2. Type the following command to shut down the WSL instance .
  3. 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.

https://github.com/okibcn/wslcompact

分類:Issues

搶先發佈留言

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

由 Compete Themes 設計的 Author 佈景主題