From 5a9c7c51e67f0d5c8689c712df7280587813f2ad Mon Sep 17 00:00:00 2001 From: "Leo R. Lundgren" Date: Tue, 13 Feb 2018 23:28:38 +0100 Subject: [PATCH 1/3] Fix --keep-* options list formatting. --- doc/060_forget.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/060_forget.rst b/doc/060_forget.rst index 6458a3774..0ca804d81 100644 --- a/doc/060_forget.rst +++ b/doc/060_forget.rst @@ -145,19 +145,20 @@ tags use ``--group-by paths,tags``. The policy is then applied to each group of snapshots separately. This is a safety feature. The ``forget`` command accepts the following parameters: + - ``--keep-last n`` never delete the ``n`` last (most recent) snapshots - ``--keep-hourly n`` for the last ``n`` hours in which a snapshot was -made, keep only the last snapshot for each hour. + made, keep only the last snapshot for each hour. - ``--keep-daily n`` for the last ``n`` days which have one or more -snapshots, only keep the last one for that day. + snapshots, only keep the last one for that day. - ``--keep-weekly n`` for the last ``n`` weeks which have one or more -snapshots, only keep the last one for that week. + snapshots, only keep the last one for that week. - ``--keep-monthly n`` for the last ``n`` months which have one or more -snapshots, only keep the last one for that month. + snapshots, only keep the last one for that month. - ``--keep-yearly n`` for the last ``n`` years which have one or more -snapshots, only keep the last one for that year. + snapshots, only keep the last one for that year. - ``--keep-tag`` keep all snapshots which have all tags specified by -this option (can be specified multiple times). + this option (can be specified multiple times). Additionally, you can restrict removing snapshots to those which have a particular hostname with the ``--hostname`` parameter, or tags with the From 71a4ccea7123faade912eb8ae2f971182364ac72 Mon Sep 17 00:00:00 2001 From: "Leo R. Lundgren" Date: Wed, 14 Feb 2018 00:20:09 +0100 Subject: [PATCH 2/3] Document refusal to process empty forget policy. --- doc/060_forget.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/060_forget.rst b/doc/060_forget.rst index 0ca804d81..5e439081f 100644 --- a/doc/060_forget.rst +++ b/doc/060_forget.rst @@ -188,6 +188,12 @@ All the ``--keep-*`` options above only count hours/days/weeks/months/years which have a snapshot, so those without a snapshot are ignored. +For safety reasons, restic refuses to act on an "empty" policy. For example, +if one were to specify ``--keep-last 0`` to forget *all* snapshots in the +repository, restic will respond that no snapshots will be removed. To delete +all snapshots, use ``--keep-last 1`` and then finally remove the last +snapshot ID manually (by passing the ID to ``forget``). + All snapshots are evaluated counted against all matching keep-* counts. A single snapshot on 2017-09-30 (Sun) will count as a daily, weekly and monthly. From 8b95b48baeaf0fc9ed049712f77bebbadee2850c Mon Sep 17 00:00:00 2001 From: "Leo R. Lundgren" Date: Wed, 14 Feb 2018 00:24:42 +0100 Subject: [PATCH 3/3] Fix grammar and formatting. --- doc/060_forget.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/060_forget.rst b/doc/060_forget.rst index 5e439081f..2a3595952 100644 --- a/doc/060_forget.rst +++ b/doc/060_forget.rst @@ -194,7 +194,7 @@ repository, restic will respond that no snapshots will be removed. To delete all snapshots, use ``--keep-last 1`` and then finally remove the last snapshot ID manually (by passing the ID to ``forget``). -All snapshots are evaluated counted against all matching keep-* counts. A +All snapshots are evaluated against all matching ``--keep-*`` counts. A single snapshot on 2017-09-30 (Sun) will count as a daily, weekly and monthly. Let's explain this with an example: Suppose you have only made a backup