prune.rst.inc 3.6 KB

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