prune.rst.inc 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_prune:
  3. borg prune
  4. ----------
  5. ::
  6. borg [common options] prune <options> REPOSITORY
  7. positional arguments
  8. REPOSITORY
  9. repository to prune
  10. optional arguments
  11. ``-n``, ``--dry-run``
  12. | do not change repository
  13. ``--force``
  14. | force pruning of corrupted archives
  15. ``-s``, ``--stats``
  16. | print statistics for the deleted archive
  17. ``--list``
  18. | output verbose list of archives it keeps/prunes
  19. ``--keep-within WITHIN``
  20. | keep all archives within this time interval
  21. ``--keep-last``, ``--keep-secondly``
  22. | number of secondly archives to keep
  23. ``--keep-minutely``
  24. | number of minutely archives to keep
  25. ``-H``, ``--keep-hourly``
  26. | number of hourly archives to keep
  27. ``-d``, ``--keep-daily``
  28. | number of daily archives to keep
  29. ``-w``, ``--keep-weekly``
  30. | number of weekly archives to keep
  31. ``-m``, ``--keep-monthly``
  32. | number of monthly archives to keep
  33. ``-y``, ``--keep-yearly``
  34. | number of yearly archives to keep
  35. ``-P``, ``--prefix``
  36. | only consider archive names starting with this prefix
  37. ``--save-space``
  38. | work slower, but using less space
  39. :ref:`common_options`
  40. |
  41. Description
  42. ~~~~~~~~~~~
  43. The prune command prunes a repository by deleting all archives not matching
  44. any of the specified retention options. This command is normally used by
  45. automated backup scripts wanting to keep a certain number of historic backups.
  46. Also, prune automatically removes checkpoint archives (incomplete archives left
  47. behind by interrupted backup runs) except if the checkpoint is the latest
  48. archive (and thus still needed). Checkpoint archives are not considered when
  49. comparing archive counts against the retention limits (--keep-X).
  50. If a prefix is set with -P, then only archives that start with the prefix are
  51. considered for deletion and only those archives count towards the totals
  52. specified by the rules.
  53. Otherwise, *all* archives in the repository are candidates for deletion!
  54. There is no automatic distinction between archives representing different
  55. contents. These need to be distinguished by specifying matching prefixes.
  56. If you have multiple sequences of archives with different data sets (e.g.
  57. from different machines) in one shared repository, use one prune call per
  58. data set that matches only the respective archives using the -P option.
  59. The "--keep-within" option takes an argument of the form "<int><char>",
  60. where char is "H", "d", "w", "m", "y". For example, "--keep-within 2d" means
  61. to keep all archives that were created within the past 48 hours.
  62. "1m" is taken to mean "31d". The archives kept with this option do not
  63. count towards the totals specified by any other options.
  64. A good procedure is to thin out more and more the older your backups get.
  65. As an example, "--keep-daily 7" means to keep the latest backup on each day,
  66. up to 7 most recent days with backups (days without backups do not count).
  67. The rules are applied from secondly to yearly, and backups selected by previous
  68. rules do not count towards those of later rules. The time that each backup
  69. starts is used for pruning purposes. Dates and times are interpreted in
  70. the local timezone, and weeks go from Monday to Sunday. Specifying a
  71. negative number of archives to keep means that there is no limit.
  72. The "--keep-last N" option is doing the same as "--keep-secondly N" (and it will
  73. keep the last N archives under the assumption that you do not create more than one
  74. backup archive in the same second).