I am trying to better understand how restic
handles the same directory being backed up by different commands.
The situation is as follows, running restic snapshots
gives me:
ID Time Host Tags Paths
------------------------------------------------------------
fa575c2d 2020-01-02 12:38:31 dispenser /home
1839dc19 2020-01-25 01:50:10 dispenser /home
d89b7470 2020-02-07 20:54:14 dispenser /home
47965192 2020-02-12 17:42:15 dispenser /home
1e7f191a 2020-02-13 22:48:26 dispenser /etc
/home
8129d134 2020-02-14 22:29:52 dispenser /etc
/home
e367c717 2020-02-15 20:36:48 dispenser /etc
/home
dc35865b 2020-02-16 16:40:40 dispenser /etc
/home
4ef3c951 2020-02-26 23:57:06 dispenser /etc
/home
35ce3ebc 2020-02-29 00:56:58 dispenser /etc
/home
09006ec3 2020-05-02 18:08:33 dispenser /etc
/home
a619023b 2020-05-21 17:57:49 dispenser /etc
/home
739a9cfc 2020-07-11 19:16:04 dispenser /etc
/home
a2213d75 2020-07-12 13:55:01 dispenser /etc
/home
a15eff04 2020-10-07 00:15:04 dispenser /etc
/home
984db7cd 2020-10-24 00:11:59 dispenser /etc
/home
------------------------------------------------------------
16 snapshots
By issuing the following command restic forget --keep-weekly 6 --prune --dry-run
this is the output:
Applying Policy: keep the last 6 weekly snapshots
snapshots for (host [dispenser], paths [/etc, /home]):
keep 6 snapshots:
ID Time Host Tags Reasons Paths
-----------------------------------------------------------------------------
dc35865b 2020-02-16 16:40:40 dispenser weekly snapshot /etc
/home
35ce3ebc 2020-02-29 00:56:58 dispenser weekly snapshot /etc
/home
09006ec3 2020-05-02 18:08:33 dispenser weekly snapshot /etc
/home
a619023b 2020-05-21 17:57:49 dispenser weekly snapshot /etc
/home
a2213d75 2020-07-12 13:55:01 dispenser weekly snapshot /etc
/home
a15eff04 2020-10-07 00:15:04 dispenser weekly snapshot /etc
/home
-----------------------------------------------------------------------------
6 snapshots
remove 5 snapshots:
ID Time Host Tags Paths
------------------------------------------------------------
1e7f191a 2020-02-13 22:48:26 dispenser /etc
/home
8129d134 2020-02-14 22:29:52 dispenser /etc
/home
e367c717 2020-02-15 20:36:48 dispenser /etc
/home
4ef3c951 2020-02-26 23:57:06 dispenser /etc
/home
739a9cfc 2020-07-11 19:16:04 dispenser /etc
/home
------------------------------------------------------------
5 snapshots
snapshots for (host [dispenser], paths [/home]):
keep 4 snapshots:
ID Time Host Tags Reasons Paths
-----------------------------------------------------------------------------
fa575c2d 2020-01-02 12:38:31 dispenser weekly snapshot /home
1839dc19 2020-01-25 01:50:10 dispenser weekly snapshot /home
d89b7470 2020-02-07 20:54:14 dispenser weekly snapshot /home
47965192 2020-02-12 17:42:15 dispenser weekly snapshot /home
-----------------------------------------------------------------------------
4 snapshots
5 snapshots have been removed, running prune
My expectation from reading the docs (not the code) would be that the last 4 snapshots wouldn’t be kept, since 6 snapshots for /home
already exist; instead it seems I’m effectively keeping 10 snapshots for that directory.
Why is this happening?
If restic
works by considering restic backup /data1 /data2
as a single group of directories, it would probably be better for me issue two separate commands (1 per directory) so as to retain only X snapshots per directory, correct?