prune.rst.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. [--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. --keep-within WITHIN keep all archives within this time interval
  29. -H HOURLY, --keep-hourly HOURLY
  30. number of hourly archives to keep
  31. -d DAILY, --keep-daily DAILY
  32. number of daily archives to keep
  33. -w WEEKLY, --keep-weekly WEEKLY
  34. number of weekly archives to keep
  35. -m MONTHLY, --keep-monthly MONTHLY
  36. number of monthly archives to keep
  37. -y YEARLY, --keep-yearly YEARLY
  38. number of yearly archives to keep
  39. -p PREFIX, --prefix PREFIX
  40. only consider archive names starting with this prefix
  41. --save-space work slower, but using less space
  42. Description
  43. ~~~~~~~~~~~
  44. The prune command prunes a repository by deleting archives not matching
  45. any of the specified retention options. This command is normally used by
  46. automated backup scripts wanting to keep a certain number of historic backups.
  47. As an example, "-d 7" means to keep the latest backup on each day for 7 days.
  48. Days without backups do not count towards the total.
  49. The rules are applied from hourly to yearly, and backups selected by previous
  50. rules do not count towards those of later rules. The time that each backup
  51. completes is used for pruning purposes. Dates and times are interpreted in
  52. the local timezone, and weeks go from Monday to Sunday. Specifying a
  53. negative number of archives to keep means that there is no limit.
  54. The "--keep-within" option takes an argument of the form "<int><char>",
  55. where char is "H", "d", "w", "m", "y". For example, "--keep-within 2d" means
  56. to keep all archives that were created within the past 48 hours.
  57. "1m" is taken to mean "31d". The archives kept with this option do not
  58. count towards the totals specified by any other options.
  59. If a prefix is set with -p, then only archives that start with the prefix are
  60. considered for deletion and only those archives count towards the totals
  61. specified by the rules.
  62. Otherwise, *all* archives in the repository are candidates for deletion!