From 1a2906ae7e09f1bef3aaf27f8ccfb3a99282ca0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 18 Nov 2017 09:08:37 -0500 Subject: [PATCH] add FAQ about removing old files and policies This has been asked twice already this year: https://mail.python.org/pipermail/borgbackup/2017q3/000796.html https://mail.python.org/pipermail/borgbackup/2017q4/000891.html ... and I was asked again privately today, so this qualifies as FAQ to me. --- docs/faq.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/faq.rst b/docs/faq.rst index 051d28806..e3c11634e 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -296,6 +296,34 @@ the archive, compacting the segments, and committing the repo & cache. This mean when Borg is run with e.g. the ``time`` command, the duration shown in the archive stats may be shorter than the full time the command runs for. +How do I configure different prune policies for different directories? +---------------------------------------------------------------------- + +Say you want to prune ``/var/log`` faster than the rest of +``/``. How do we implement that? The answer is to backup to different +archive *names* and then implement different prune policies for +different prefixes. For example, you could have a script that does:: + + borg create $REPOSITORY:main-$(date +%Y-%m-%d) --exclude /var/log / + borg create $REPOSITORY:logs-$(date +%Y-%m-%d) /var/log + +Then you would have two different prune calls with different policies:: + + borg prune --verbose --list -d 30 --prefix main- "$REPOSITORY" + borg prune --verbose --list -d 7 --prefix logs- "$REPOSITORY" + +This will keep 7 days of logs and 30 days of everything else. Borg 1.1 +also supports the ``--glob-archives`` parameter. + +How do I remove files from an existing backup? +---------------------------------------------- + +Say you now want to remove old logfiles because you changed your +backup policy as described above. The only way to do this is to use +the :ref:`borg_recreate` command to rewrite all archives with a +different ``--exclude`` pattern. See the examples in the +:ref:`borg_recreate` manpage for more information. + Security ########