1 min read

Clean old google-cloud-sdk versions

Google cloud SDK will always keep the previous revision on the server, installed by snap, just in case anything goes wrong. However they are 1GB, so if you are file storage conscious then this becomes a pickle.

To list all snap revisions run:

root@server:~# snap list --all
Name              Version        Rev    Tracking         Publisher          Notes
core18            20230703       2790   latest/stable    canonical✓         base
core20            20230801       2015   latest/stable    canonical✓         base
google-cloud-sdk  444.0.0        376    latest/stable/…  google-cloud-sdk✓  classic
google-cloud-sdk  445.0.0        378    latest/stable/…  google-cloud-sdk✓  classic
lxd               4.0.9-a29c6f1  24061  4.0/stable/…     canonical✓         -
snapd             2.60.3         20092  latest/stable    canonical✓         snapd

Now as you can see (I did fake it, since I have already cleaned up the revision) we have 2 versions of the google-cloud-sdk. To delete the older one you need to reference the "Rev" value, which is 376 in this case.

root@server:~# snap remove google-cloud-sdk --revision 376

This will then remove that snap and boom, you cleaned up like 800mb of pointless space utilization, until Google release a new version next week.