Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Lock snapshots #891

Open
grisu48 opened this issue Apr 2, 2024 · 0 comments
Open

Feature request: Lock snapshots #891

grisu48 opened this issue Apr 2, 2024 · 0 comments

Comments

@grisu48
Copy link

grisu48 commented Apr 2, 2024

It would be great being able to "lock" snapshots to prevent them from accidental deletion

User story

Before larger TW updated I typically create manual snapshots. This has saved me a couple of times in the past already.
However over time, the number of snapshots might get confusing and very large, so one is required to delete a whole range of them.

e.g.

   # | Type   | Pre # | Date                     | User | Used Space | Cleanup | Description                            | Userdata     
-----+--------+-------+--------------------------+------+------------+---------+----------------------------------------+--------------
  0  | single |       |                          | root |            |         | current                                |              
  1* | single |       | Tue Nov  7 14:02:39 2023 | root |  16.00 KiB |         | first root filesystem                  |              
  3  | single |       | Tue Nov  7 14:23:38 2023 | root |   4.76 GiB |         | Fresh                                  |              
101  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
102  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
109  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
111  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
124  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
131  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
142  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
156  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
159  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
161  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
163  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
191  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
199  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
201  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
289  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
301  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
305  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
310  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
321  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
333  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
339  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
342  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
352  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
362  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
372  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
389  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
399  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
405  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
409  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
411  | single |       | Tue Nov  7 14:23:38 2023 | root |   X.XX GiB |         | TW snapshot                            |              
605  | single |       | Wed Feb  7 10:52:55 2024 | root |   7.02 GiB |         | TW 20240205 on 2024-02-07              |              
665  | single |       | Thu Mar 14 09:21:15 2024 | root |   3.02 GiB |         | Before Plasma6                         |              
681  | pre    |       | Mon Mar 25 08:30:23 2024 | root |  38.25 MiB | number  | zypp(zypper)                           | important=yes
682  | post   |   281 | Mon Mar 25 08:30:38 2024 | root |  73.91 MiB | number  |                                        | important=yes
693  | pre    |       | Thu Mar 28 08:23:14 2024 | root | 567.48 MiB | number  | zypp(zypper)                           | important=yes
694  | post   |   293 | Thu Mar 28 08:29:58 2024 | root |   7.80 MiB | number  |                                        | important=yes
695  | single |       | Thu Mar 28 14:42:11 2024 | root |  11.27 MiB |         | TW 20240326 on 2024-03-28 with Plasma6 |              
696  | pre    |       | Tue Apr  2 07:52:02 2024 | root | 181.45 MiB | number  | zypp(zypper)                           | important=yes
697  | post   |   296 | Tue Apr  2 08:47:10 2024 | root |  14.96 MiB | number  |                                        | important=yes
698  | single |       | Tue Apr  2 08:52:47 2024 | root |  16.00 KiB |         | TW 20240329 - after libzma vuln        |     

Here at some point it becomes natural to just run a snapper rm 101-411. It could be however that one of those snapshots is important, and I want to lock if to prevent accidental deletion.

The approach of setting important=yes in userdata appears as too weak for this use case. There should be a harder policy, that really doesn't allow the user to delete a snapshot unless it is explicitly unlocked before.

Desired outcome

Here, let's assume snapshot 321 is important because of reasons. I propose a feature that allows the user to lock a snapshot, e.g.

# snapper lock 321

and then

# snapper rm 101-411
error: Snapshot 321 is locked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants