Backing up & pruning multiple folders in one snapshot

I’ve done a quick search and can’t find this answered so apologies if it’s already been asked.

I want to backup multiple folders to a single repository, however I want to be able to add folders to the repository organically over time.

I’ve been backing up with multiple folders under one snapshot:

90597fe0  2021-07-03 08:00:01  my-server              /boot/config/plugins/dockerMan/templates-user
                                                        /boot/config/plugins/user.scripts
                                                        /mnt/user/appdata

In February I was only backing up /mnt/user/appdata to the repository. Then I added the two directories in /boot.

I wanted to restore a file from the backup today and I noticed that there were lingering snapshots that only contain /mnt/user/appdata from way back in February that don’t seem to have been pruned:

keep 12 snapshots:
ID        Time                 Host         Tags        Reasons           Paths
-------------------------------------------------------------------------------------------
7be12eca  2021-02-07 04:46:17  my-server              daily snapshot    /mnt/user/appdata
                                                        weekly snapshot
58044117  2021-02-08 05:00:08  my-server              daily snapshot    /mnt/user/appdata
056d6a47  2021-02-10 09:00:02  my-server              daily snapshot    /mnt/user/appdata
687c9a79  2021-02-11 09:00:02  my-server              daily snapshot    /mnt/user/appdata
8fc56b0c  2021-02-12 09:00:01  my-server              daily snapshot    /mnt/user/appdata
0b66cee0  2021-02-13 09:03:10  my-server              daily snapshot    /mnt/user/appdata
97adcf34  2021-02-14 09:00:01  my-server              daily snapshot    /mnt/user/appdata
                                                        weekly snapshot
0f7afe95  2021-02-15 09:00:02  my-server              daily snapshot    /mnt/user/appdata
abd805ec  2021-02-16 09:00:02  my-server              daily snapshot    /mnt/user/appdata
0e11db5e  2021-02-17 09:00:02  my-server              daily snapshot    /mnt/user/appdata
c5a1648e  2021-02-18 09:00:01  my-server              daily snapshot    /mnt/user/appdata
dc41c641  2021-02-19 09:00:01  my-server              daily snapshot    /mnt/user/appdata
                                                        weekly snapshot
                                                        monthly snapshot
-------------------------------------------------------------------------------------------

In addition to:

Applying Policy: keep 30 daily, 8 weekly, 6 monthly snapshots
keep 37 snapshots:
ID        Time                 Host         Tags        Reasons           Paths
-----------------------------------------------------------------------------------------------------------------------
e746f91b  2021-02-28 09:00:01  my-server              monthly snapshot  /boot/config/plugins/dockerMan/templates-user
                                                                          /boot/config/plugins/user.scripts
                                                                          /mnt/user/appdata

895f9f3f  2021-03-31 08:00:01  my-server              monthly snapshot  /boot/config/plugins/dockerMan/templates-user
                                                                          /boot/config/plugins/user.scripts
                                                                          /mnt/user/appdata

c2bd38c5  2021-04-30 08:00:02  my-server              monthly snapshot  /boot/config/plugins/dockerMan/templates-user
                                                                          /boot/config/plugins/user.scripts
                                                                          /mnt/user/appdata

Am I misunderstanding how forget works? The default group-by is host,paths and I’ve read on this forum that it doesn’t matter if you specify backups individually or all together, but in this case where I want to add folders to the repository over time does it matter?

forget first groups the snapshots and then applies the forget policy to each of these groups.

You need to combine two things here:

  1. Forget-policy: Keeping 30 Daily snapshots means you keep 30 snapshots starting from the last snapshot in the group and counting backwards.
  2. Grouping: Grouping is done by host, paths per default. When you add a path to your backup, you create a new group.

As you aren’t adding any new snapshots to your original group (my-server, /mnt/user/appdata), you will keep the first snapshots forever.

Solution: Only group by host using the -g option to forget.

2 Likes

I get it now, thanks that actually makes sense. Cheers!