skip to content
Alvin Lucillo

Clear up storage space

/ 1 min read

If you are using Docker, you may be accumulating unused containers and images that take up disk space. Sometimes it’s good to perform some disk space clean up, especially if you have limited storage.

  1. Remove unused containers, images, and build cache
docker system prune -a
docker builder prune -a
  1. Shutdown WSL and verify that it’s not running. Use PowerShell.
wsl --shutdown
wsl -l -v
  1. Run diskpart on PowerShell. It will open another window.
  2. Perform vdisk compaction. Without this, you won’t actually see the freed space on the host machine.
select vdisk file="C:\Users\YourUsername\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu-or-some-dir\LocalState\filename.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit