Cleaning Up Rancher Desktop vhdx

Cleaning Up Rancher Desktop vhdx

My machine running rancher desktop started to throw disk space errors after running for the last few months. Taking a look at the disk space space with windir stat I noticed ext4.vhdx was consuming almost a 1/4 of the drive. So lets clean this up.

Clean up old docker data

PS C:\Users\james> docker system prune -a
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y


Deleted Containers:
7154b9d4e056149d0ff6f04341709180fae780ba051995be2f209f802d8bea87
58ed2cc4938f014930dbc5039f29d8e54cceb366e0843e6e453eb4d77cfdef4d
be6a89fcda49b7796b35949d0fffe1becbf32567d57a63ea42441588e98852c2
3d1be20b285e5a2dff227028e89b4def97e06c805ad0952889e7955bbc39dbf0
a38be52de6d633db8557abb9dc8c71a2a130489b571379ae46de63d9434145fa
b11e5988a1c3f592b1a49737fa81803b5df02f41addd3fb281340260271082d7
..
..
Deleted Images:
untagged: rancher/klipper-helm:v0.8.3-build20240228
deleted: sha256:0929b4140ada6f9e22dcbd50b15225babc4bc99822a237de438fdcf77ea26821
deleted: sha256:79b33f397569ec8ca933c845213cc6f8827b5a6431414741b1104af4723def5a
deleted: sha256:8ca459aaeecba47323254cb255b147d27319d0c87fce163bf65b3a3b3698565b
deleted: sha256:267b2f6e6193c43eee17e20dd5b0cae26632ec1cc3ef470c7fc87063ae66a5ca
untagged: prom/prometheus@sha256:565ee86501224ebbb98fc10b332fa54440b100469924003359edf49cbce374bd
..
..
Total reclaimed space: 791.1MB

Just send it..

Shutdown Rancher Desktop (data is cleaned up on shutdown, and startup)

  • File > Exit
File > Exit to shutdown and trigger clean up according to folks on github

Stop all wsl machines, and validate they are stopped.

wsl --shutdown
wsl --list --verbose
  NAME                    STATE           VERSION
* Ubuntu                  Stopped         2
  rancher-desktop-data    Stopped         2
  rancher-desktop         Stopped         2

Launch disk part, and run compaction.

    • This will take a few minutes
> diskpart

DISKPART> select vdisk file="C:\Users\james\AppData\Local\rancher-desktop\distro-data\ext4.vhdx"

DiskPart successfully selected the virtual disk file.

DISKPART> compact vdisk

  100 percent completed

DiskPart successfully compacted the virtual disk file.
End result only saved about 7GB of data. 😭After digging into the file system usage a about 80GB is from PVCs. As for the other 60GB is have no idea why its consumed.


💡
Links I used to troubleshoot 🙏 to all the ppl that post online..