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

--delete-never Not Working #1148

Closed
ossie-git opened this issue May 7, 2024 · 4 comments · Fixed by #1149
Closed

--delete-never Not Working #1148

ossie-git opened this issue May 7, 2024 · 4 comments · Fixed by #1149
Labels
C-bug Category: Something isn't working as expected

Comments

@ossie-git
Copy link

Hi,

I was testing out --delete-never. From my understanding, it should protect a snapshot from being delted. However, from my testing, it appears to not do anything. This is what I tried using rustic v0.7.0:

$ cat ~/.config/rustic/rustic.toml
[repository]
repository = "/tmp/repo"
password = "test"
no-cache = true
$ rustic backup --delete-never /home/vagrant/btrfs-snapshot-diff/
[INFO] using config /home/vagrant/.config/rustic/rustic.toml
[INFO] repository local:/tmp/repo: password is correct.
[INFO] using no cache
[00:00:00] reading index...               ████████████████████████████████████████          3/3         [00:00:00]                                ████████████████████████████████████████          0
[00:00:00] getting latest snapshot...     ████████████████████████████████████████          0/0         [INFO] using no parent
[INFO] starting to backup "/home/vagrant/btrfs-snapshot-diff"...
[00:00:00] backing up...                  ████████████████████████████████████████ 150.72 KiB/150.72 KiB 4.04 MiB/s   (ETA 0s)Files:       32 new, 0 changed, 0 unchanged
Dirs:        21 new, 0 changed, 0 unchanged
Added to the repo: 0 B (raw: 0 B)
processed 32 files, 150.7 kiB
snapshot 4717f033 successfully saved.
[INFO] backup of "/home/vagrant/btrfs-snapshot-diff" done.
$ rustic snapshots
[INFO] using config /home/vagrant/.config/rustic/rustic.toml
[INFO] repository local:/tmp/repo: password is correct.
[INFO] using no cache

snapshots for (host [localhost-live], label [], paths [/home/vagrant/btrfs-snapshot-diff])
| ID       | Time       | Host            | Label | Tags | Paths          | Files | Dirs |      Size |
|----------|------------|-----------------|-------|------|----------------|-------|------|-----------|
| 4717f033 | 2024-05-07 | localhost-live  |       |      | /home/vagrant/ |    32 |   21 | 150.7 kiB |
|          | 16:10:41   |                 |       |      | btrfs-snapshot |       |      |           |
|          |            |                 |       |      | -diff          |       |      |           |
1 snapshot(s)

total: 1 snapshot(s)
$ rustic snapshots --long
[INFO] using config /home/vagrant/.config/rustic/rustic.toml
[INFO] repository local:/tmp/repo: password is correct.
[INFO] using no cache

snapshots for (host [localhost-live], label [], paths [/home/vagrant/btrfs-snapshot-diff])
| Snapshot      | 4717f033d9cb98cb2aa807cd83361cf6e75738ca2430787cb8ec37b5dc9bb402             |
| Time          | 2024-05-07 16:10:41                                                          |
| Generated by  | rustic v0.7.0                                                                |
| Host          | localhost-live                                                               |
| Label         |                                                                              |
| Tags          |                                                                              |
| Delete        | never                                                                        |
| Paths         | /home/vagrant/btrfs-snapshot-diff                                            |
| Parent        | no parent snapshot                                                           |
|               |                                                                              |
| Command       | rustic backup --delete-never /home/vagrant/btrfs-snapshot-diff/              |
| Source        | files: 32 / dirs: 21 / size: 150.7 kiB                                       |
|               |                                                                              |
| Files         | new:         32 / changed:          0 / unchanged:          0                |
| Dirs          | new:         21 / changed:          0 / unchanged:          0                |
|               |                                                                              |
| Added to repo | data:           0 blobs / raw:        0 B / packed:        0 B               |
|               | tree:           0 blobs / raw:        0 B / packed:        0 B               |
|               | total:          0 blobs / raw:        0 B / packed:        0 B               |
| Duration      | backup start: 2024-05-07 16:10:41 / backup end: 2024-05-07 16:10:41 / backup |
|               | duration: 36ms 296us 750ns                                                   |
|               | total duration: 36ms 624us 293ns                                             |

1 snapshot(s)

total: 1 snapshot(s)

$ rustic forget 4717f033
[INFO] using config /home/vagrant/.config/rustic/rustic.toml
[INFO] repository local:/tmp/repo: password is correct.
[INFO] using no cache

| ID       | Time       | Host           | Label | Tags | Paths               | Action | Reason      |
|----------|------------|----------------|-------|------|---------------------|--------|-------------|
| 4717f033 | 2024-05-07 | localhost-live |       |      | /home/vagrant/btrfs | remove | id argument |
|          | 16:10:41   |                |       |      | -snapshot-diff      |        |             |

[00:00:00] removing snapshots...          ████████████████████████████████████████          1/1         
$ rustic snapshots
[INFO] using config /home/vagrant/.config/rustic/rustic.toml
[INFO] repository local:/tmp/repo: password is correct.
[INFO] using no cache

total: 0 snapshot(s)

Am I missing something? Thanks

@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label May 7, 2024
@aawsome
Copy link
Member

aawsome commented May 7, 2024

Thanks for opening this issue @ossie-git.

You are right, --delete-never currently does not work if you specify snapshot IDs to remove directly - this is a bug. It is so far respected when applying forget policies and also in the interactive mode.

Note that --delete-never is however not able to fully protect snapshots from being deleted unless you have access protection in your storage backend. If not, you can always delete the snapshot files from the backend without using rustic. See also #1050 and #1066 for discussions about additional protection in the storage backend.

@aawsome aawsome added C-bug Category: Something isn't working as expected and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels May 7, 2024
@aawsome
Copy link
Member

aawsome commented May 7, 2024

As a side note: Besides --delete-never for individual snapshots, there is also the possibility to mark the whole repository as append-only using rustic config --set-append-only. This prevents forget from removing any snapshot. (and also prune does no longer work)

@ossie-git
Copy link
Author

Thanks a lot. I actually ended up using Rustic instead of Restic for two primary reasons:

  • developer responsiveness (this issue is a great example)
  • features

@aawsome
Copy link
Member

aawsome commented May 7, 2024

Thanks for you comment @ossie-git! We very much appreciate getting reports of bugs or feature requests! Also positive (or negative) feedback is very appreciated. This gives motivation to keep on improving rustic! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants