prune.rst.inc 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .. _borg_prune:
  2. borg prune
  3. ----------
  4. ::
  5. usage: borg prune [-h] [-v] [--debug] [--lock-wait N] [--show-rc]
  6. [--no-files-cache] [--umask M] [--remote-path PATH] [-n]
  7. [-s] [--keep-within WITHIN] [-H HOURLY] [-d DAILY]
  8. [-w WEEKLY] [-m MONTHLY] [-y YEARLY] [-p PREFIX]
  9. [REPOSITORY]
  10. Prune repository archives according to specified rules
  11. positional arguments:
  12. REPOSITORY repository to prune
  13. optional arguments:
  14. -h, --help show this help message and exit
  15. -v, --verbose, --info
  16. enable informative (verbose) output, work on log level
  17. INFO
  18. --debug enable debug output, work on log level DEBUG
  19. --lock-wait N wait for the lock, but max. N seconds (default: 1).
  20. --show-rc show/log the return code (rc)
  21. --no-files-cache do not load/update the file metadata cache used to
  22. detect unchanged files
  23. --umask M set umask to M (local and remote, default: 0077)
  24. --remote-path PATH set remote path to executable (default: "borg")
  25. -n, --dry-run do not change repository
  26. -s, --stats print statistics for the deleted archive
  27. --keep-within WITHIN keep all archives within this time interval
  28. -H HOURLY, --keep-hourly HOURLY
  29. number of hourly archives to keep
  30. -d DAILY, --keep-daily DAILY
  31. number of daily archives to keep
  32. -w WEEKLY, --keep-weekly WEEKLY
  33. number of weekly archives to keep
  34. -m MONTHLY, --keep-monthly MONTHLY
  35. number of monthly archives to keep
  36. -y YEARLY, --keep-yearly YEARLY
  37. number of yearly archives to keep
  38. -p PREFIX, --prefix PREFIX
  39. only consider archive names starting with this prefix
  40. Description
  41. ~~~~~~~~~~~
  42. The prune command prunes a repository by deleting archives not matching
  43. any of the specified retention options. This command is normally used by
  44. automated backup scripts wanting to keep a certain number of historic backups.
  45. As an example, "-d 7" means to keep the latest backup on each day for 7 days.
  46. Days without backups do not count towards the total.
  47. The rules are applied from hourly to yearly, and backups selected by previous
  48. rules do not count towards those of later rules. The time that each backup
  49. completes is used for pruning purposes. Dates and times are interpreted in
  50. the local timezone, and weeks go from Monday to Sunday. Specifying a
  51. negative number of archives to keep means that there is no limit.
  52. The "--keep-within" option takes an argument of the form "<int><char>",
  53. where char is "H", "d", "w", "m", "y". For example, "--keep-within 2d" means
  54. to keep all archives that were created within the past 48 hours.
  55. "1m" is taken to mean "31d". The archives kept with this option do not
  56. count towards the totals specified by any other options.
  57. If a prefix is set with -p, then only archives that start with the prefix are
  58. considered for deletion and only those archives count towards the totals
  59. specified by the rules.
  60. Otherwise, *all* archives in the repository are candidates for deletion!