Snapper question

Hi, I have read a lot about the snapper function but I do not fully understand what to keep or not, so a basic level question…
I have just created a single snapshot and let say for any future rollback I am happy to roll back to this snap, do I then need to keep the snaps prior to my just created snap… see list below (expand the image to see the full list)…

sudo snapper list
   # | Type   | Før # | Dato                               | Bruker | Used Space | Rydde opp | Beskrivelse           | Brukerdata   
-----+--------+-------+------------------------------------+--------+------------+-----------+-----------------------+--------------
  0  | single |       |                                    | root   |            |           | current               |              
  1* | single |       | ti. 09. april 2024 kl. 19.58 +0200 | root   |  16,00 KiB |           | first root filesystem |              
 61  | single |       | to. 11. april 2024 kl. 13.18 +0200 | root   |   1,34 GiB |           |                       |              
 88  | pre    |       | sø. 21. april 2024 kl. 12.09 +0200 | root   |  64,99 MiB | number    | zypp(zypper)          | important=yes
 89  | post   |    88 | sø. 21. april 2024 kl. 12.10 +0200 | root   |  66,25 MiB | number    |                       | important=yes
 90  | pre    |       | sø. 21. april 2024 kl. 12.11 +0200 | root   |   1,12 MiB | number    | zypp(zypper)          | important=yes
 91  | post   |    90 | sø. 21. april 2024 kl. 12.11 +0200 | root   |  29,88 MiB | number    |                       | important=yes
 92  | pre    |       | on. 24. april 2024 kl. 17.11 +0200 | root   |  11,87 MiB | number    | zypp(zypper)          | important=yes
 93  | post   |    92 | on. 24. april 2024 kl. 17.12 +0200 | root   | 121,62 MiB | number    |                       | important=yes
 94  | pre    |       | fr. 26. april 2024 kl. 08.00 +0200 | root   |   5,53 MiB | number    | zypp(zypper)          | important=no 
 95  | post   |    94 | fr. 26. april 2024 kl. 08.00 +0200 | root   |  21,13 MiB | number    |                       | important=no 
 96  | pre    |       | sø. 05. mai 2024 kl. 13.39 +0200   | root   |  14,47 MiB | number    | zypp(zypper)          | important=yes
 97  | post   |    96 | sø. 05. mai 2024 kl. 13.42 +0200   | root   | 148,77 MiB | number    |                       | important=yes
 98  | pre    |       | sø. 05. mai 2024 kl. 13.43 +0200   | root   | 224,00 KiB | number    | zypp(zypper)          | important=yes
 99  | post   |    98 | sø. 05. mai 2024 kl. 13.43 +0200   | root   | 240,00 KiB | number    |                       | important=yes
100  | pre    |       | sø. 05. mai 2024 kl. 18.31 +0200   | root   | 384,00 KiB | number    | yast sysconfig        |              
101  | post   |   100 | sø. 05. mai 2024 kl. 18.32 +0200   | root   | 112,00 KiB | number    |                       |              
102  | single |       | sø. 05. mai 2024 kl. 18.35 +0200   | root   |  16,00 KiB |           |                       |        

You can delete a range of snapshots by doing:

sudo snapper rm 61-90

As long as 61 and 90 exists, it will delete all snapshots within that range.

But a better way is to set up a cleanup algorithm such as number for all snaps so they’re automatically cleaned up. Here’s the relevant portion from man 8 snapper:

   Cleanup Algorithms
       Snapper provides several algorithms to clean up old snapshots. The algorithms are executed in a daily cronjob or systemd timer. This can be configured in the
       corresponding configurations files along with parameters for every algorithm.

       number
           Deletes old snapshots when a certain number of snapshots is reached.

       timeline
           Deletes old snapshots but keeps a number of hourly, daily, weekly, monthly and yearly snapshots.

       empty-pre-post
           Deletes pre/post snapshot pairs with empty diffs.

       The number and timeline cleanup algorithms can also try to keep the space used by snapshots below a limit and the free space of the filesystem above a limit. For
       the first condition quota must be setup, see command setup-quota. Additional the NUMBER_LIMIT and TIMELINE_LIMIT variables in the config file must have ranges
       (min- and max-value). The algorithms will then make two passes:

        1. Delete snapshots above the max-value independent of the snapshot and filesystem space.

        2. Delete snapshots above the min-value until the limits for the snapshot and filesystem are reached.

       The limit for the used space can be configured via the SPACE_LIMIT variable. Note: Only snapshots that have a cleanup algorithm set are taken into account when
       calculating the space used by snapshots. The limit for the free space can be configured via the FREE_LIMIT variable.

Hi, thanks for your reply, but the question was not about how to delete them, I am aware of deleting a range etc,.
I was wondering which can be deleted or not. Why are som marked with important=yes and some =no.

Do I need any of the earlier snaps to be able to rollback to my last created snap?

This is described in the openSUSE reference handbook:

But what about my last question, it is a yes or no question.

Do I need any of the earlier snaps to be able to rollback to my last created snap?

If your last snapshot is a working/good one, you don’t need the older ones for a rollback.

1 Like

Thanks, good to get that confirmed.

Two follow-up questions, just trying to understand:

For instance, within three months time from now I want to roll back to my snapshot created today. Do I need any snapshot created after today’s created (single type) snapshot?

Will a snapshot increase it’s size as time goes and modifications are applied. If not, how can my single type snapshot of today of 16 KiB contain a full restore for several months of modifications?

I guess miss some basic understanding how snapshot works, so sorry asking stupid questions.

Be careful, number 1 should never be eliminated, but it shouldn’t let you.
Please note that in openSUSE every time you update your system or make changes from zypper or yast, a snapshot will be created.

No. Each snapshot is a complete filesystem.

Yes, it will.

1 Like

arvidjaar, thanks very much appreciated, then all of it makes sense and is a lot clearer, at least to me. Just don’t happy about performing commands not “fully” understood.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.