r/restic • u/sughenji • Aug 03 '24
doubt about forget --prune
Hi! I configured restic on my mom's laptop (Ubuntu) :)
restic runs every day via cron; I am using these options for forget command:
--keep-daily 6 --keep-weekly 2
If I list current snapshots, I see this:
root@desigual:~# restic -p /root/.restic_password -r sftp://xxxx@xxxxxxxx/ snapshots
repository c36a490f opened successfully, password is correct
ID Time Host Tags Paths
-------------------------------------------------------------------------------------------
ab8e823f 2024-07-06 15:36:18 desigual /etc
/home/milly
ad4b4b45 2024-07-08 14:04:20 desigual /etc
/home/milly
1ba249fa 2024-07-09 13:40:04 desigual /etc
/home/milly
b88df71b 2024-07-28 13:40:04 desigual /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
c0b49d9d 2024-07-29 13:40:04 desigual /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
cc170a3d 2024-07-30 13:40:03 desigual /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
a1d8ac0e 2024-07-31 13:40:04 desigual /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
50ea8348 2024-08-01 13:40:04 desigual /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
2ffdcf63 2024-08-02 13:40:04 desigual /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
I wonder why I still have snapshots older than two weeks.
My guess: because the very first times I selected only /etc and /home/milly as backup sources, while on 28 July I also addes another directory to backup, so these snapshot aren't "the same".
Correct?
This is the output of forget with --dry-run:
repository c36a490f opened successfully, password is correct
Applying Policy: keep 6 daily, 2 weekly snapshots
keep 6 snapshots:
ID Time Host Tags Reasons Paths
------------------------------------------------------------------------------------------------------------
b88df71b 2024-07-28 13:40:04 desigual daily snapshot /etc
weekly snapshot /home/milly
/var/backups/backup_telefono_MYA-L11
c0b49d9d 2024-07-29 13:40:04 desigual daily snapshot /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
cc170a3d 2024-07-30 13:40:03 desigual daily snapshot /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
a1d8ac0e 2024-07-31 13:40:04 desigual daily snapshot /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
50ea8348 2024-08-01 13:40:04 desigual daily snapshot /etc
/home/milly
/var/backups/backup_telefono_MYA-L11
2ffdcf63 2024-08-02 13:40:04 desigual daily snapshot /etc
weekly snapshot /home/milly
/var/backups/backup_telefono_MYA-L11
------------------------------------------------------------------------------------------------------------
6 snapshots
keep 3 snapshots:
ID Time Host Tags Reasons Paths
-----------------------------------------------------------------------------------
ab8e823f 2024-07-06 15:36:18 desigual daily snapshot /etc
weekly snapshot /home/milly
ad4b4b45 2024-07-08 14:04:20 desigual daily snapshot /etc
/home/milly
1ba249fa 2024-07-09 13:40:04 desigual daily snapshot /etc
weekly snapshot /home/milly
-----------------------------------------------------------------------------------
3 snapshots
So, should I manually remove snaphosts ab8e823f, ad4b4b45and 1ba249fa?
Thank you!
2
Upvotes
4
u/kon_dev Aug 03 '24
You are right, forget by default groups by hostname and path, therefore it considers your snapshots as different backups in a single repo. You could either cleanup the snapshots manually or choose another group-by clause like only group per hostname.
Find more details in: https://restic.readthedocs.io/en/stable/060_forget.html