prune.rst.inc 3.5 KB

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