prune.rst.inc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. .. _borg_prune:
  2. borg prune
  3. ----------
  4. ::
  5. borg prune <options> REPOSITORY
  6. positional arguments
  7. REPOSITORY
  8. repository to prune
  9. optional arguments
  10. ``-n``, ``--dry-run``
  11. | do not change repository
  12. ``-s``, ``--stats``
  13. | print statistics for the deleted archive
  14. ``--list``
  15. | output verbose list of archives it keeps/prunes
  16. ``--keep-within WITHIN``
  17. | keep all archives within this time interval
  18. ``-H``, ``--keep-hourly``
  19. | number of hourly archives to keep
  20. ``-d``, ``--keep-daily``
  21. | number of daily archives to keep
  22. ``-w``, ``--keep-weekly``
  23. | number of weekly archives to keep
  24. ``-m``, ``--keep-monthly``
  25. | number of monthly archives to keep
  26. ``-y``, ``--keep-yearly``
  27. | number of yearly archives to keep
  28. ``-P``, ``--prefix``
  29. | only consider archive names starting with this prefix
  30. ``--save-space``
  31. | work slower, but using less space
  32. `Common options`_
  33. |
  34. Description
  35. ~~~~~~~~~~~
  36. The prune command prunes a repository by deleting all archives not matching
  37. any of the specified retention options. This command is normally used by
  38. automated backup scripts wanting to keep a certain number of historic backups.
  39. As an example, "-d 7" means to keep the latest backup on each day, up to 7
  40. most recent days with backups (days without backups do not count).
  41. The rules are applied from hourly to yearly, and backups selected by previous
  42. rules do not count towards those of later rules. The time that each backup
  43. starts is used for pruning purposes. Dates and times are interpreted in
  44. the local timezone, and weeks go from Monday to Sunday. Specifying a
  45. negative number of archives to keep means that there is no limit.
  46. The "--keep-within" option takes an argument of the form "<int><char>",
  47. where char is "H", "d", "w", "m", "y". For example, "--keep-within 2d" means
  48. to keep all archives that were created within the past 48 hours.
  49. "1m" is taken to mean "31d". The archives kept with this option do not
  50. count towards the totals specified by any other options.
  51. If a prefix is set with -P, then only archives that start with the prefix are
  52. considered for deletion and only those archives count towards the totals
  53. specified by the rules.
  54. Otherwise, *all* archives in the repository are candidates for deletion!