How to Reclaiming Disk Space From WSL VHDX

Summary:
In this article, we will guide you on how to reclaim disk space from the VHDX files used by Windows Subsystem for Linux (WSL). By following a few simple steps, you can free up valuable disk space on your Windows system.

1. Open a terminal on Windows.

2. Launch the Diskpart utility by running the command diskpart. This will open the Diskpart window.

3. In the Diskpart window, execute the following commands:

select vdisk file="C:\WSL-Distros\…\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit

These commands select the VHDX file associated with your WSL distribution, attach it in read-only mode, compact the disk space, and then detach it.

4. After executing the commands, the disk space occupied by the VHDX file will be reclaimed.

文章作者: Coin
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Coin's blog
Diskpart VHDX WSL Powershell Tutorial
喜欢就支持一下吧