borg-prune.1 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH BORG-PRUNE 1 "2017-03-26" "" "borg backup tool"
  4. .SH NAME
  5. borg-prune \- Prune repository archives according to specified rules
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  33. .SH SYNOPSIS
  34. .sp
  35. borg prune <options> REPOSITORY
  36. .SH DESCRIPTION
  37. .sp
  38. The prune command prunes a repository by deleting all 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. .sp
  42. Also, prune automatically removes checkpoint archives (incomplete archives left
  43. behind by interrupted backup runs) except if the checkpoint is the latest
  44. archive (and thus still needed). Checkpoint archives are not considered when
  45. comparing archive counts against the retention limits (\-\-keep\-X).
  46. .sp
  47. If a prefix is set with \-P, then only archives that start with the prefix are
  48. considered for deletion and only those archives count towards the totals
  49. specified by the rules.
  50. Otherwise, \fIall\fP archives in the repository are candidates for deletion!
  51. There is no automatic distinction between archives representing different
  52. contents. These need to be distinguished by specifying matching prefixes.
  53. .sp
  54. If you have multiple sequences of archives with different data sets (e.g.
  55. from different machines) in one shared repository, use one prune call per
  56. data set that matches only the respective archives using the \-P option.
  57. .sp
  58. The "\-\-keep\-within" option takes an argument of the form "<int><char>",
  59. where char is "H", "d", "w", "m", "y". For example, "\-\-keep\-within 2d" means
  60. to keep all archives that were created within the past 48 hours.
  61. "1m" is taken to mean "31d". The archives kept with this option do not
  62. count towards the totals specified by any other options.
  63. .sp
  64. A good procedure is to thin out more and more the older your backups get.
  65. As an example, "\-\-keep\-daily 7" means to keep the latest backup on each day,
  66. up to 7 most recent days with backups (days without backups do not count).
  67. The rules are applied from secondly to yearly, and backups selected by previous
  68. rules do not count towards those of later rules. The time that each backup
  69. starts is used for pruning purposes. Dates and times are interpreted in
  70. the local timezone, and weeks go from Monday to Sunday. Specifying a
  71. negative number of archives to keep means that there is no limit.
  72. .sp
  73. The "\-\-keep\-last N" option is doing the same as "\-\-keep\-secondly N" (and it will
  74. keep the last N archives under the assumption that you do not create more than one
  75. backup archive in the same second).
  76. .SH OPTIONS
  77. .sp
  78. See \fIborg\-common(1)\fP for common options of Borg commands.
  79. .SS arguments
  80. .INDENT 0.0
  81. .TP
  82. .B REPOSITORY
  83. repository to prune
  84. .UNINDENT
  85. .SS optional arguments
  86. .INDENT 0.0
  87. .TP
  88. .B \-n\fP,\fB \-\-dry\-run
  89. do not change repository
  90. .TP
  91. .B \-\-force
  92. force pruning of corrupted archives
  93. .TP
  94. .B \-p\fP,\fB \-\-progress
  95. show progress display while deleting archives
  96. .TP
  97. .B \-s\fP,\fB \-\-stats
  98. print statistics for the deleted archive
  99. .TP
  100. .B \-\-list
  101. output verbose list of archives it keeps/prunes
  102. .TP
  103. .BI \-\-keep\-within \ WITHIN
  104. keep all archives within this time interval
  105. .TP
  106. .B \-\-keep\-last\fP,\fB \-\-keep\-secondly
  107. number of secondly archives to keep
  108. .TP
  109. .B \-\-keep\-minutely
  110. number of minutely archives to keep
  111. .TP
  112. .B \-H\fP,\fB \-\-keep\-hourly
  113. number of hourly archives to keep
  114. .TP
  115. .B \-d\fP,\fB \-\-keep\-daily
  116. number of daily archives to keep
  117. .TP
  118. .B \-w\fP,\fB \-\-keep\-weekly
  119. number of weekly archives to keep
  120. .TP
  121. .B \-m\fP,\fB \-\-keep\-monthly
  122. number of monthly archives to keep
  123. .TP
  124. .B \-y\fP,\fB \-\-keep\-yearly
  125. number of yearly archives to keep
  126. .TP
  127. .B \-P\fP,\fB \-\-prefix
  128. only consider archive names starting with this prefix
  129. .TP
  130. .B \-\-save\-space
  131. work slower, but using less space
  132. .UNINDENT
  133. .SH EXAMPLES
  134. .sp
  135. Be careful, prune is a potentially dangerous command, it will remove backup
  136. archives.
  137. .sp
  138. The default of prune is to apply to \fBall archives in the repository\fP unless
  139. you restrict its operation to a subset of the archives using \fB\-\-prefix\fP\&.
  140. When using \fB\-\-prefix\fP, be careful to choose a good prefix \- e.g. do not use a
  141. prefix "foo" if you do not also want to match "foobar".
  142. .sp
  143. It is strongly recommended to always run \fBprune \-v \-\-list \-\-dry\-run ...\fP
  144. first so you will see what it would do without it actually doing anything.
  145. .sp
  146. There is also a visualized prune example in \fBdocs/misc/prune\-example.txt\fP\&.
  147. .INDENT 0.0
  148. .INDENT 3.5
  149. .sp
  150. .nf
  151. .ft C
  152. # Keep 7 end of day and 4 additional end of week archives.
  153. # Do a dry\-run without actually deleting anything.
  154. $ borg prune \-v \-\-list \-\-dry\-run \-\-keep\-daily=7 \-\-keep\-weekly=4 /path/to/repo
  155. # Same as above but only apply to archive names starting with the hostname
  156. # of the machine followed by a "\-" character:
  157. $ borg prune \-v \-\-list \-\-keep\-daily=7 \-\-keep\-weekly=4 \-\-prefix=\(aq{hostname}\-\(aq /path/to/repo
  158. # Keep 7 end of day, 4 additional end of week archives,
  159. # and an end of month archive for every month:
  160. $ borg prune \-v \-\-list \-\-keep\-daily=7 \-\-keep\-weekly=4 \-\-keep\-monthly=\-1 /path/to/repo
  161. # Keep all backups in the last 10 days, 4 additional end of week archives,
  162. # and an end of month archive for every month:
  163. $ borg prune \-v \-\-list \-\-keep\-within=10d \-\-keep\-weekly=4 \-\-keep\-monthly=\-1 /path/to/repo
  164. .ft P
  165. .fi
  166. .UNINDENT
  167. .UNINDENT
  168. .SH SEE ALSO
  169. .sp
  170. \fIborg\-common(1)\fP
  171. .SH AUTHOR
  172. The Borg Collective
  173. .\" Generated by docutils manpage writer.
  174. .