borg-prune.1 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH BORG-PRUNE 1 "2017-05-17" "" "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 [common options] 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 \-s\fP,\fB \-\-stats
  95. print statistics for the deleted archive
  96. .TP
  97. .B \-\-list
  98. output verbose list of archives it keeps/prunes
  99. .TP
  100. .BI \-\-keep\-within \ WITHIN
  101. keep all archives within this time interval
  102. .TP
  103. .B \-\-keep\-last\fP,\fB \-\-keep\-secondly
  104. number of secondly archives to keep
  105. .TP
  106. .B \-\-keep\-minutely
  107. number of minutely archives to keep
  108. .TP
  109. .B \-H\fP,\fB \-\-keep\-hourly
  110. number of hourly archives to keep
  111. .TP
  112. .B \-d\fP,\fB \-\-keep\-daily
  113. number of daily archives to keep
  114. .TP
  115. .B \-w\fP,\fB \-\-keep\-weekly
  116. number of weekly archives to keep
  117. .TP
  118. .B \-m\fP,\fB \-\-keep\-monthly
  119. number of monthly archives to keep
  120. .TP
  121. .B \-y\fP,\fB \-\-keep\-yearly
  122. number of yearly archives to keep
  123. .TP
  124. .B \-P\fP,\fB \-\-prefix
  125. only consider archive names starting with this prefix
  126. .TP
  127. .B \-\-save\-space
  128. work slower, but using less space
  129. .UNINDENT
  130. .SH EXAMPLES
  131. .sp
  132. Be careful, prune is a potentially dangerous command, it will remove backup
  133. archives.
  134. .sp
  135. The default of prune is to apply to \fBall archives in the repository\fP unless
  136. you restrict its operation to a subset of the archives using \fB\-\-prefix\fP\&.
  137. When using \fB\-\-prefix\fP, be careful to choose a good prefix \- e.g. do not use a
  138. prefix "foo" if you do not also want to match "foobar".
  139. .sp
  140. It is strongly recommended to always run \fBprune \-v \-\-list \-\-dry\-run ...\fP
  141. first so you will see what it would do without it actually doing anything.
  142. .sp
  143. There is also a visualized prune example in \fBdocs/misc/prune\-example.txt\fP\&.
  144. .INDENT 0.0
  145. .INDENT 3.5
  146. .sp
  147. .nf
  148. .ft C
  149. # Keep 7 end of day and 4 additional end of week archives.
  150. # Do a dry\-run without actually deleting anything.
  151. $ borg prune \-v \-\-list \-\-dry\-run \-\-keep\-daily=7 \-\-keep\-weekly=4 /path/to/repo
  152. # Same as above but only apply to archive names starting with the hostname
  153. # of the machine followed by a "\-" character:
  154. $ borg prune \-v \-\-list \-\-keep\-daily=7 \-\-keep\-weekly=4 \-\-prefix=\(aq{hostname}\-\(aq /path/to/repo
  155. # Keep 7 end of day, 4 additional end of week archives,
  156. # and an end of month archive for every month:
  157. $ borg prune \-v \-\-list \-\-keep\-daily=7 \-\-keep\-weekly=4 \-\-keep\-monthly=\-1 /path/to/repo
  158. # Keep all backups in the last 10 days, 4 additional end of week archives,
  159. # and an end of month archive for every month:
  160. $ borg prune \-v \-\-list \-\-keep\-within=10d \-\-keep\-weekly=4 \-\-keep\-monthly=\-1 /path/to/repo
  161. .ft P
  162. .fi
  163. .UNINDENT
  164. .UNINDENT
  165. .SH SEE ALSO
  166. .sp
  167. \fIborg\-common(1)\fP
  168. .SH AUTHOR
  169. The Borg Collective
  170. .\" Generated by docutils manpage writer.
  171. .