From 7948912b311cc3a304fa6c804cb2fa4f24c9e709 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 19 May 2024 00:34:18 +0200 Subject: [PATCH] document --unsafe-allow-remove-all option --- doc/060_forget.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/060_forget.rst b/doc/060_forget.rst index 113098d0c..b8d206c97 100644 --- a/doc/060_forget.rst +++ b/doc/060_forget.rst @@ -182,7 +182,9 @@ The ``forget`` command accepts the following policy options: - ``--keep-yearly n`` for the last ``n`` years which have one or more snapshots, keep only the most recent one for each 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). The ``forget`` command will + exit with an error if all snapshots in a snapshot group would be removed + as none of them have the specified tags. - ``--keep-within duration`` keep all snapshots having a timestamp within the specified duration of the latest snapshot, where ``duration`` is a number of years, months, days, and hours. E.g. ``2y5m7d3h`` will keep all @@ -336,12 +338,23 @@ year and yearly for the last 75 years, you can instead specify ``forget --keep-within-yearly 75y`` (note that `1w` is not a recognized duration, so you will have to specify `7d` instead). + +Removing all snapshots +====================== + 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 manually (by passing the ID to ``forget``). +Since restic 0.17.0, it is possible to delete all snapshots for a specific +host, tag or path using the ``--unsafe-allow-remove-all`` option. The option +must always be combined with a snapshot filter (by host, path or tag). +For example the command ``forget --tag example --unsafe-allow-remove-all`` +removes all snapshots with tag ``example``. + + Security considerations in append-only mode ===========================================