prune.rst.inc 3.0 KB

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