4

I noticed with disc analyzer that my disk free space is gone down from 974 GB to 971 GB over time on system updates and my snaps folder went from 1 GB to 3 GB.

Do system snaps get larger as system updates get newer?

8

Old versions of snaps are retained by the system but you can remove them and control what goes on behind the scenes.

The default number of versions retained is 3 but there is a snap option to use in terminal to reduce that to 2:

sudo snap set system refresh.retain=2

and you can write a script to remove old snap revisions.

This reference shows you how.

7
  • "The default number of versions retained is 3" — just as a clarification: here 3 means the one being used currently and two previous older versions, right? So refresh.retain=2 would mean: current, and only one previous instance, right? – Levente Jun 12 at 15:37
  • The linked reference answers that with "to set the maximum number of a snap's revisions stored by the system after the next refresh". – 24601 Jun 12 at 15:46
  • I can't figure it out even from that whole sentence... (Update: if I had to guess, I would say "revisions" mean only old versions, and the current one does not count in "revisions"...) – Levente Jun 12 at 15:48
  • 1
    @Levente Revisions include the latest and previous snap. You should be able to check by comparing the results of snap list and snap list --all and looking at the 'Rev' column. snap list will show you the latest/currently in use version, or 'revision', or each of your snaps. snap list --all shows the latest and previous revisions. If you use the refresh.retain=2 option, you should have 2 of each snap: the latest revision, and one previous revision. – wizardpurple Jun 12 at 21:15
  • 1
    @Levente by default, "refresh.retain=3 on Ubuntu Core systems and refresh.retain=2 on classic Ubuntu systems, such as those running Ubuntu 18.04 LTS (Bionic Beaver) and Ubuntu 16.04 LTS (Xenial Xerus)" (src). And it appears that by default, "Options are not visible until after they are set. The snap get command can then be used to check their state" (system options doc) which seems very odd that they wouldn't return a default value. – wizardpurple Jun 12 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.