prune.rst.inc 3.6 KB

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