borg.1 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  1. '\" t
  2. .\" Man page generated from reStructuredText.
  3. .
  4. .
  5. .nr rst2man-indent-level 0
  6. .
  7. .de1 rstReportMargin
  8. \\$1 \\n[an-margin]
  9. level \\n[rst2man-indent-level]
  10. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  11. -
  12. \\n[rst2man-indent0]
  13. \\n[rst2man-indent1]
  14. \\n[rst2man-indent2]
  15. ..
  16. .de1 INDENT
  17. .\" .rstReportMargin pre:
  18. . RS \\$1
  19. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  20. . nr rst2man-indent-level +1
  21. .\" .rstReportMargin post:
  22. ..
  23. .de UNINDENT
  24. . RE
  25. .\" indent \\n[an-margin]
  26. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  27. .nr rst2man-indent-level -1
  28. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  30. ..
  31. .TH "BORG" "1" "2025-12-23" "" "borg backup tool"
  32. .SH NAME
  33. borg \- deduplicating and encrypting backup tool
  34. .SH SYNOPSIS
  35. .sp
  36. borg [common options] <command> [options] [arguments]
  37. .SH DESCRIPTION
  38. .\" we don't include the README.rst here since we want to keep this terse.
  39. .
  40. .sp
  41. BorgBackup (short: Borg) is a deduplicating backup program.
  42. Optionally, it supports compression and authenticated encryption.
  43. .sp
  44. The main goal of Borg is to provide an efficient and secure way to back up data.
  45. The data deduplication technique used makes Borg suitable for daily backups
  46. since only changes are stored.
  47. The authenticated encryption technique makes it suitable for backups to targets not
  48. fully trusted.
  49. .sp
  50. Borg stores a set of files in an \fIarchive\fP\&. A \fIrepository\fP is a collection
  51. of \fIarchives\fP\&. The format of repositories is Borg\-specific. Borg does not
  52. distinguish archives from each other in any way other than their name,
  53. it does not matter when or where archives were created (e.g., different hosts).
  54. .SH EXAMPLES
  55. .SS A step\-by\-step example
  56. .INDENT 0.0
  57. .IP 1. 3
  58. Before a backup can be made, a repository has to be initialized:
  59. .INDENT 3.0
  60. .INDENT 3.5
  61. .sp
  62. .EX
  63. $ borg \-r /path/to/repo repo\-create \-\-encryption=repokey\-aes\-ocb
  64. .EE
  65. .UNINDENT
  66. .UNINDENT
  67. .IP 2. 3
  68. Back up the \fB~/src\fP and \fB~/Documents\fP directories into an archive called
  69. \fIdocs\fP:
  70. .INDENT 3.0
  71. .INDENT 3.5
  72. .sp
  73. .EX
  74. $ borg \-r /path/to/repo create docs ~/src ~/Documents
  75. .EE
  76. .UNINDENT
  77. .UNINDENT
  78. .IP 3. 3
  79. The next day, create a new archive using the same archive name:
  80. .INDENT 3.0
  81. .INDENT 3.5
  82. .sp
  83. .EX
  84. $ borg \-r /path/to/repo create \-\-stats docs ~/src ~/Documents
  85. .EE
  86. .UNINDENT
  87. .UNINDENT
  88. .sp
  89. This backup will be much quicker and much smaller, since only new,
  90. never\-before\-seen data is stored. The \fB\-\-stats\fP option causes Borg to
  91. output statistics about the newly created archive such as the deduplicated
  92. size (the amount of unique data not shared with other archives):
  93. .INDENT 3.0
  94. .INDENT 3.5
  95. .sp
  96. .EX
  97. Repository: /path/to/repo
  98. Archive name: docs
  99. Archive fingerprint: bcd1b53f9b4991b7afc2b339f851b7ffe3c6d030688936fe4552eccc1877718d
  100. Time (start): Sat, 2022\-06\-25 20:21:43
  101. Time (end): Sat, 2022\-06\-25 20:21:43
  102. Duration: 0.07 seconds
  103. Utilization of maximum archive size: 0%
  104. Number of files: 699
  105. Original size: 31.14 MB
  106. Deduplicated size: 502 B
  107. .EE
  108. .UNINDENT
  109. .UNINDENT
  110. .IP 4. 3
  111. List all archives in the repository:
  112. .INDENT 3.0
  113. .INDENT 3.5
  114. .sp
  115. .EX
  116. $ borg \-r /path/to/repo repo\-list
  117. docs Sat, 2022\-06\-25 20:21:14 [b80e24d2...b179f298]
  118. docs Sat, 2022\-06\-25 20:21:43 [bcd1b53f...1877718d]
  119. .EE
  120. .UNINDENT
  121. .UNINDENT
  122. .IP 5. 3
  123. List the contents of the first archive:
  124. .INDENT 3.0
  125. .INDENT 3.5
  126. .sp
  127. .EX
  128. $ borg \-r /path/to/repo list aid:b80e24d2
  129. drwxr\-xr\-x user group 0 Mon, 2016\-02\-15 18:22:30 home/user/Documents
  130. \-rw\-r\-\-r\-\- user group 7961 Mon, 2016\-02\-15 18:22:30 home/user/Documents/Important.doc
  131. \&...
  132. .EE
  133. .UNINDENT
  134. .UNINDENT
  135. .IP 6. 3
  136. Restore the first archive by extracting the files relative to the current directory:
  137. .INDENT 3.0
  138. .INDENT 3.5
  139. .sp
  140. .EX
  141. $ borg \-r /path/to/repo extract aid:b80e24d2
  142. .EE
  143. .UNINDENT
  144. .UNINDENT
  145. .IP 7. 3
  146. Delete the first archive (please note that this does \fBnot\fP free repository disk space):
  147. .INDENT 3.0
  148. .INDENT 3.5
  149. .sp
  150. .EX
  151. $ borg \-r /path/to/repo delete aid:b80e24d2
  152. .EE
  153. .UNINDENT
  154. .UNINDENT
  155. .sp
  156. Be careful if you use an archive NAME (and not an archive ID), as it might match multiple archives.
  157. Always use \fB\-\-dry\-run\fP and \fB\-\-list\fP first!
  158. .IP 8. 3
  159. Recover disk space by compacting the segment files in the repository:
  160. .INDENT 3.0
  161. .INDENT 3.5
  162. .sp
  163. .EX
  164. $ borg \-r /path/to/repo compact \-v
  165. .EE
  166. .UNINDENT
  167. .UNINDENT
  168. .UNINDENT
  169. .sp
  170. \fBNOTE:\fP
  171. .INDENT 0.0
  172. .INDENT 3.5
  173. Borg is quiet by default (it defaults to WARNING log level).
  174. You can use options like \fB\-\-progress\fP or \fB\-\-list\fP to get specific
  175. reports during command execution. You can also add the \fB\-v\fP (or
  176. \fB\-\-verbose\fP or \fB\-\-info\fP) option to adjust the log level to INFO to
  177. get other informational messages.
  178. .UNINDENT
  179. .UNINDENT
  180. .SH NOTES
  181. .SS Positional Arguments and Options: Order matters
  182. .sp
  183. Borg only supports taking options (\fB\-s\fP and \fB\-\-progress\fP in the example)
  184. either to the left or to the right of all positional arguments (\fBrepo::archive\fP and \fBpath\fP
  185. in the example), but not in between them:
  186. .INDENT 0.0
  187. .INDENT 3.5
  188. .sp
  189. .EX
  190. borg create \-s \-\-progress archive path # good and preferred
  191. borg create archive path \-s \-\-progress # also works
  192. borg create \-s archive path \-\-progress # works, but ugly
  193. borg create archive \-s \-\-progress path # BAD
  194. .EE
  195. .UNINDENT
  196. .UNINDENT
  197. .sp
  198. This is due to a problem in the argparse module: <https://bugs.python.org/issue15112>
  199. .SS Repository URLs
  200. .sp
  201. \fBLocal filesystem\fP (or locally mounted network filesystem):
  202. .sp
  203. \fB/path/to/repo\fP — filesystem path to the repository directory (absolute path)
  204. .sp
  205. \fBpath/to/repo\fP — filesystem path to the repository directory (relative path)
  206. .sp
  207. Also, paths like \fB~/path/to/repo\fP or \fB~other/path/to/repo\fP work (this is
  208. expanded by your shell).
  209. .sp
  210. Note: You may also prepend \fBfile://\fP to a filesystem path to use URL style.
  211. .sp
  212. \fBRemote repositories\fP accessed via SSH <user@host> :
  213. .sp
  214. \fBssh://user@host:port//abs/path/to/repo\fP — absolute path
  215. .sp
  216. \fBssh://user@host:port/rel/path/to/repo\fP — path relative to the current directory
  217. .sp
  218. \fBRemote repositories\fP accessed via SFTP:
  219. .sp
  220. \fBsftp://user@host:port//abs/path/to/repo\fP — absolute path
  221. .sp
  222. \fBsftp://user@host:port/rel/path/to/repo\fP — path relative to the current directory
  223. .sp
  224. For SSH and SFTP URLs, the \fBuser@\fP and \fB:port\fP parts are optional.
  225. .sp
  226. \fBRemote repositories\fP accessed via rclone:
  227. .sp
  228. \fBrclone:remote:path\fP — see the rclone docs for more details about \fBremote:path\fP\&.
  229. .sp
  230. \fBRemote repositories\fP accessed via S3:
  231. .sp
  232. \fB(s3|b2):[profile|(access_key_id:access_key_secret)@][schema://hostname[:port]]/bucket/path\fP — see the boto3 docs for more details about credentials.
  233. .sp
  234. If you are connecting to AWS S3, \fB[schema://hostname[:port]]\fP is optional, but \fBbucket\fP and \fBpath\fP are always required.
  235. .sp
  236. Note: There is a known issue with some S3\-compatible services, e.g., Backblaze B2. If you encounter problems, try using \fBb2:\fP instead of \fBs3:\fP in the URL.
  237. .sp
  238. If you frequently need the same repository URL, it is a good idea to set the
  239. \fBBORG_REPO\fP environment variable to set a default repository URL:
  240. .INDENT 0.0
  241. .INDENT 3.5
  242. .sp
  243. .EX
  244. export BORG_REPO=\(aqssh://user@host:port/rel/path/to/repo\(aq
  245. .EE
  246. .UNINDENT
  247. .UNINDENT
  248. .sp
  249. Then simply omit the \fB\-\-repo\fP option when you want
  250. to use the default — it will be read from BORG_REPO.
  251. .SS Repository Locations / Archive Names
  252. .sp
  253. Many commands need to know the repository location; specify it via \fB\-r\fP/\fB\-\-repo\fP
  254. or use the \fBBORG_REPO\fP environment variable.
  255. .sp
  256. Commands that need one or two archive names usually take them as positional arguments.
  257. .sp
  258. Commands that work with an arbitrary number of archives usually accept \fB\-a ARCH_GLOB\fP\&.
  259. .sp
  260. Archive names must not contain the \fB/\fP (slash) character. For simplicity,
  261. also avoid spaces or other characters that have special meaning to the
  262. shell or in a filesystem (\fBborg mount\fP uses the archive name as a directory
  263. name).
  264. .SS Logging
  265. .sp
  266. Borg writes all log output to stderr by default. However, output on stderr does
  267. not necessarily indicate an error. Check the log levels of the messages and the
  268. return code of borg to determine error, warning, or success conditions.
  269. .sp
  270. If you want to capture the log output to a file, just redirect it:
  271. .INDENT 0.0
  272. .INDENT 3.5
  273. .sp
  274. .EX
  275. borg create \-\-repo repo archive myfiles 2>> logfile
  276. .EE
  277. .UNINDENT
  278. .UNINDENT
  279. .sp
  280. Custom logging configurations can be implemented via BORG_LOGGING_CONF.
  281. .sp
  282. The log level of the built\-in logging configuration defaults to WARNING.
  283. This is because we want Borg to be mostly silent and only output
  284. warnings, errors, and critical messages unless output has been requested
  285. by supplying an option that implies output (e.g., \fB\-\-list\fP or \fB\-\-progress\fP).
  286. .sp
  287. Log levels: DEBUG < INFO < WARNING < ERROR < CRITICAL
  288. .sp
  289. Use \fB\-\-debug\fP to set the DEBUG log level —
  290. this prints debug, info, warning, error, and critical messages.
  291. .sp
  292. Use \fB\-\-info\fP (or \fB\-v\fP or \fB\-\-verbose\fP) to set the INFO log level —
  293. this prints info, warning, error, and critical messages.
  294. .sp
  295. Use \fB\-\-warning\fP (default) to set the WARNING log level —
  296. this prints warning, error, and critical messages.
  297. .sp
  298. Use \fB\-\-error\fP to set the ERROR log level —
  299. this prints error and critical messages.
  300. .sp
  301. Use \fB\-\-critical\fP to set the CRITICAL log level —
  302. this prints only critical messages.
  303. .sp
  304. While you can set miscellaneous log levels, do not expect every command to
  305. produce different output at different log levels — it\(aqs merely a possibility.
  306. .sp
  307. \fBWARNING:\fP
  308. .INDENT 0.0
  309. .INDENT 3.5
  310. Options \fB\-\-critical\fP and \fB\-\-error\fP are provided for completeness,
  311. their usage is not recommended as you might miss important information.
  312. .UNINDENT
  313. .UNINDENT
  314. .SS Return codes
  315. .sp
  316. Borg can exit with the following return codes (rc):
  317. .TS
  318. box center;
  319. l|l.
  320. T{
  321. Return code
  322. T} T{
  323. Meaning
  324. T}
  325. _
  326. T{
  327. 0
  328. T} T{
  329. success (logged as INFO)
  330. T}
  331. _
  332. T{
  333. 1
  334. T} T{
  335. generic warning (operation reached its normal end, but there were warnings —
  336. you should check the log; logged as WARNING)
  337. T}
  338. _
  339. T{
  340. 2
  341. T} T{
  342. generic error (like a fatal error or a local/remote exception; the operation
  343. did not reach its normal end; logged as ERROR)
  344. T}
  345. _
  346. T{
  347. 3..99
  348. T} T{
  349. specific error (enabled by BORG_EXIT_CODES=modern)
  350. T}
  351. _
  352. T{
  353. 100..127
  354. T} T{
  355. specific warning (enabled by BORG_EXIT_CODES=modern)
  356. T}
  357. _
  358. T{
  359. 128+N
  360. T} T{
  361. killed by signal N (e.g. 137 == kill \-9)
  362. T}
  363. .TE
  364. .sp
  365. If you use \fB\-\-show\-rc\fP, the return code is also logged at the indicated
  366. level as the last log entry.
  367. .sp
  368. The modern exit codes (return codes, \(dqrc\(dq) are documented here: see \fImsgid\fP\&.
  369. .SS Environment Variables
  370. .sp
  371. Borg uses some environment variables for automation:
  372. .INDENT 0.0
  373. .TP
  374. .B General:
  375. .INDENT 7.0
  376. .TP
  377. .B BORG_REPO
  378. When set, use the value to give the default repository location.
  379. Use this so you do not need to type \fB\-\-repo /path/to/my/repo\fP all the time.
  380. .TP
  381. .B BORG_OTHER_REPO
  382. Similar to BORG_REPO, but gives the default for \fB\-\-other\-repo\fP\&.
  383. .TP
  384. .B BORG_PASSPHRASE (and BORG_OTHER_PASSPHRASE)
  385. When set, use the value to answer the passphrase question for encrypted repositories.
  386. It is used when a passphrase is needed to access an encrypted repo as well as when a new
  387. passphrase should be initially set when initializing an encrypted repo.
  388. See also BORG_NEW_PASSPHRASE.
  389. .TP
  390. .B BORG_PASSCOMMAND (and BORG_OTHER_PASSCOMMAND)
  391. When set, use the standard output of the command (trailing newlines are stripped) to answer the
  392. passphrase question for encrypted repositories.
  393. It is used when a passphrase is needed to access an encrypted repo as well as when a new
  394. passphrase should be initially set when initializing an encrypted repo. Note that the command
  395. is executed without a shell. So variables, like \fB$HOME\fP will work, but \fB~\fP won\(aqt.
  396. If BORG_PASSPHRASE is also set, it takes precedence.
  397. See also BORG_NEW_PASSPHRASE.
  398. .TP
  399. .B BORG_PASSPHRASE_FD (and BORG_OTHER_PASSPHRASE_FD)
  400. When set, specifies a file descriptor to read a passphrase
  401. from. Programs starting borg may choose to open an anonymous pipe
  402. and use it to pass a passphrase. This is safer than passing via
  403. BORG_PASSPHRASE, because on some systems (e.g. Linux) environment
  404. can be examined by other processes.
  405. If BORG_PASSPHRASE or BORG_PASSCOMMAND are also set, they take precedence.
  406. .TP
  407. .B BORG_NEW_PASSPHRASE
  408. When set, use the value to answer the passphrase question when a \fBnew\fP passphrase is asked for.
  409. This variable is checked first. If it is not set, BORG_PASSPHRASE and BORG_PASSCOMMAND will also
  410. be checked.
  411. Main use case for this is to fully automate \fBborg change\-passphrase\fP\&.
  412. .TP
  413. .B BORG_DISPLAY_PASSPHRASE
  414. When set, use the value to answer the \(dqdisplay the passphrase for verification\(dq question when defining a new passphrase for encrypted repositories.
  415. .TP
  416. .B BORG_DEBUG_PASSPHRASE
  417. When set to YES, display debugging information that includes passphrases used and passphrase related env vars set.
  418. .TP
  419. .B BORG_EXIT_CODES
  420. When set to \(dqmodern\(dq, the borg process will return more specific exit codes (rc).
  421. When set to \(dqlegacy\(dq, the borg process will return rc 2 for all errors, 1 for all warnings, 0 for success.
  422. Default is \(dqmodern\(dq.
  423. .TP
  424. .B BORG_HOST_ID
  425. Borg usually computes a host id from the FQDN plus the results of \fBuuid.getnode()\fP (which usually returns
  426. a unique id based on the MAC address of the network interface. Except if that MAC happens to be all\-zero \- in
  427. that case it returns a random value, which is not what we want (because it kills automatic stale lock removal).
  428. So, if you have an all\-zero MAC address or other reasons to better control the host id externally, just set this
  429. environment variable to a unique value. If all your FQDNs are unique, you can just use the FQDN. If not,
  430. use <FQDN@uniqueid> \&.
  431. .TP
  432. .B BORG_LOCK_WAIT
  433. You can set the default value for the \fB\-\-lock\-wait\fP option with this, so
  434. you do not need to give it as a command line option.
  435. .TP
  436. .B BORG_LOGGING_CONF
  437. When set, use the given filename as INI <https://docs.python.org/3/library/logging.config.html#configuration-file-format>
  438. \-style logging configuration.
  439. A basic example conf can be found at \fBdocs/misc/logging.conf\fP\&.
  440. .TP
  441. .B BORG_RSH
  442. When set, use this command instead of \fBssh\fP\&. This can be used to specify ssh options, such as
  443. a custom identity file \fBssh \-i /path/to/private/key\fP\&. See \fBman ssh\fP for other options. Using
  444. the \fB\-\-rsh CMD\fP command line option overrides the environment variable.
  445. .TP
  446. .B BORG_REMOTE_PATH
  447. When set, use the given path as borg executable on the remote (defaults to \(dqborg\(dq if unset).
  448. Using the \fB\-\-remote\-path PATH\fP command line option overrides the environment variable.
  449. .TP
  450. .B BORG_REPO_PERMISSIONS
  451. Set repository permissions, see also: \fIborg_serve\fP
  452. .TP
  453. .B BORG_FILES_CACHE_SUFFIX
  454. When set to a value at least one character long, instructs borg to use a specifically named
  455. (based on the suffix) alternative files cache. This can be used to avoid loading and saving
  456. cache entries for backup sources other than the current sources.
  457. .TP
  458. .B BORG_FILES_CACHE_TTL
  459. When set to a numeric value, this determines the maximum \(dqtime to live\(dq for the files cache
  460. entries (default: 2). The files cache is used to determine quickly whether a file is unchanged.
  461. .TP
  462. .B BORG_USE_CHUNKS_ARCHIVE
  463. When set to no (default: yes), the \fBchunks.archive.d\fP folder will not be used. This reduces
  464. disk space usage but slows down cache resyncs.
  465. .TP
  466. .B BORG_SHOW_SYSINFO
  467. When set to no (default: yes), system information (like OS, Python version, ...) in
  468. exceptions is not shown.
  469. Please only use for good reasons as it makes issues harder to analyze.
  470. .TP
  471. .B BORG_MSGPACK_VERSION_CHECK
  472. Controls whether Borg checks the \fBmsgpack\fP version.
  473. The default is \fByes\fP (strict check). Set to \fBno\fP to disable the version check and
  474. allow any installed \fBmsgpack\fP version. Use this at your own risk; malfunctioning or
  475. incompatible \fBmsgpack\fP versions may cause subtle bugs or repository data corruption.
  476. .TP
  477. .B BORG_FUSE_IMPL
  478. Choose the low\-level FUSE implementation borg shall use for \fBborg mount\fP\&.
  479. This is a comma\-separated list of implementation names, they are tried in the
  480. given order, e.g.:
  481. .INDENT 7.0
  482. .IP \(bu 2
  483. \fBmfusepy,pyfuse3,llfuse\fP: default, first try to load mfusepy, then pyfuse3, then llfuse.
  484. .IP \(bu 2
  485. \fBllfuse,pyfuse3\fP: first try to load llfuse, then try to load pyfuse3.
  486. .IP \(bu 2
  487. \fBmfusepy\fP: only try to load mfusepy
  488. .IP \(bu 2
  489. \fBpyfuse3\fP: only try to load pyfuse3
  490. .IP \(bu 2
  491. \fBllfuse\fP: only try to load llfuse
  492. .IP \(bu 2
  493. \fBnone\fP: do not try to load an implementation
  494. .UNINDENT
  495. .TP
  496. .B BORG_SELFTEST
  497. This can be used to influence borg\(aqs built\-in self\-tests. The default is to execute the tests
  498. at the beginning of each borg command invocation.
  499. .sp
  500. BORG_SELFTEST=disabled can be used to switch off the tests and rather save some time.
  501. Disabling is not recommended for normal borg users, but large scale borg storage providers can
  502. use this to optimize production servers after at least doing a one\-time test borg (with
  503. self\-tests not disabled) when installing or upgrading machines/OS/Borg.
  504. .TP
  505. .B BORG_WORKAROUNDS
  506. A list of comma\-separated strings that trigger workarounds in borg,
  507. e.g. to work around bugs in other software.
  508. .sp
  509. Currently known strings are:
  510. .INDENT 7.0
  511. .TP
  512. .B basesyncfile
  513. Use the more simple BaseSyncFile code to avoid issues with sync_file_range.
  514. You might need this to run borg on WSL (Windows Subsystem for Linux) or
  515. in systemd.nspawn containers on some architectures (e.g. ARM).
  516. Using this does not affect data safety, but might result in a more bursty
  517. write\-to\-disk behavior (not continuously streaming to disk).
  518. .TP
  519. .B retry_erofs
  520. Retry opening a file without O_NOATIME if opening a file with O_NOATIME
  521. caused EROFS. You will need this to make archives from volume shadow copies
  522. in WSL1 (Windows Subsystem for Linux 1).
  523. .TP
  524. .B authenticated_no_key
  525. Work around a lost passphrase or key for an \fBauthenticated\fP mode repository
  526. (these are only authenticated, but not encrypted).
  527. If the key is missing in the repository config, add \fBkey = anything\fP there.
  528. .sp
  529. This workaround is \fBonly\fP for emergencies and \fBonly\fP to extract data
  530. from an affected repository (read\-only access):
  531. .INDENT 7.0
  532. .INDENT 3.5
  533. .sp
  534. .EX
  535. BORG_WORKAROUNDS=authenticated_no_key borg extract \-\-repo repo archive
  536. .EE
  537. .UNINDENT
  538. .UNINDENT
  539. .sp
  540. After you have extracted all data you need, you MUST delete the repository:
  541. .INDENT 7.0
  542. .INDENT 3.5
  543. .sp
  544. .EX
  545. BORG_WORKAROUNDS=authenticated_no_key borg delete repo
  546. .EE
  547. .UNINDENT
  548. .UNINDENT
  549. .sp
  550. Now you can init a fresh repo. Make sure you do not use the workaround any more.
  551. .UNINDENT
  552. .UNINDENT
  553. .TP
  554. .B Output formatting:
  555. .INDENT 7.0
  556. .TP
  557. .B BORG_LIST_FORMAT
  558. Giving the default value for \fBborg repo\-list \-\-format=X\fP\&.
  559. .TP
  560. .B BORG_RLIST_FORMAT
  561. Giving the default value for \fBborg repo\-list \-\-format=X\fP\&.
  562. .TP
  563. .B BORG_PRUNE_FORMAT
  564. Giving the default value for \fBborg prune \-\-format=X\fP\&.
  565. .UNINDENT
  566. .TP
  567. .B Some automatic \(dqanswerers\(dq (if set, they automatically answer confirmation questions):
  568. .INDENT 7.0
  569. .TP
  570. .B BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no (or =yes)
  571. For \(dqWarning: Attempting to access a previously unknown unencrypted repository\(dq
  572. .TP
  573. .B BORG_RELOCATED_REPO_ACCESS_IS_OK=no (or =yes)
  574. For \(dqWarning: The repository at location ... was previously located at ...\(dq
  575. .TP
  576. .B BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO (or =YES)
  577. For \(dqThis is a potentially dangerous function...\(dq (check \-\-repair)
  578. .TP
  579. .B BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO (or =YES)
  580. For \(dqYou requested to DELETE the repository completely \fIincluding\fP all archives it contains:\(dq
  581. .UNINDENT
  582. .sp
  583. Note: answers are case sensitive. setting an invalid answer value might either give the default
  584. answer or ask you interactively, depending on whether retries are allowed (they by default are
  585. allowed). So please test your scripts interactively before making them a non\-interactive script.
  586. .UNINDENT
  587. .INDENT 0.0
  588. .TP
  589. .B Directories and files:
  590. .INDENT 7.0
  591. .TP
  592. .B BORG_BASE_DIR
  593. Defaults to \fB$HOME\fP or \fB~$USER\fP or \fB~\fP (in that order).
  594. If you want to move all borg\-specific folders to a custom path at once, all you need to do is
  595. to modify \fBBORG_BASE_DIR\fP: the other paths for cache, config etc. will adapt accordingly
  596. (assuming you didn\(aqt set them to a different custom value).
  597. .TP
  598. .B BORG_CACHE_DIR
  599. Defaults to \fB$BORG_BASE_DIR/.cache/borg\fP\&. If \fBBORG_BASE_DIR\fP is not explicitly set while
  600. XDG env var <https://specifications.freedesktop.org/basedir-spec/0.6/ar01s03.html>
  601. \fBXDG_CACHE_HOME\fP is set, then \fB$XDG_CACHE_HOME/borg\fP is being used instead.
  602. This directory contains the local cache and might need a lot
  603. of space for dealing with big repositories. Make sure you\(aqre aware of the associated
  604. security aspects of the cache location: \fIcache_security\fP
  605. .TP
  606. .B BORG_CONFIG_DIR
  607. Defaults to \fB$BORG_BASE_DIR/.config/borg\fP\&. If \fBBORG_BASE_DIR\fP is not explicitly set while
  608. XDG env var <https://specifications.freedesktop.org/basedir-spec/0.6/ar01s03.html>
  609. \fBXDG_CONFIG_HOME\fP is set, then \fB$XDG_CONFIG_HOME/borg\fP is being used instead.
  610. This directory contains all borg configuration directories, see the FAQ
  611. for a security advisory about the data in this directory: \fIhome_config_borg\fP
  612. .TP
  613. .B BORG_DATA_DIR
  614. Defaults to \fB$BORG_BASE_DIR/.local/share/borg\fP\&. If \fBBORG_BASE_DIR\fP is not explicitly set while
  615. XDG env var <https://specifications.freedesktop.org/basedir-spec/0.6/ar01s03.html>
  616. \fBXDG_DATA_HOME\fP is set, then \fB$XDG_DATA_HOME/borg\fP is being used instead.
  617. This directory contains all borg data directories, see the FAQ
  618. for a security advisory about the data in this directory: \fIhome_data_borg\fP
  619. .TP
  620. .B BORG_RUNTIME_DIR
  621. Defaults to \fB$BORG_BASE_DIR/.cache/borg\fP\&. If \fBBORG_BASE_DIR\fP is not explicitly set while
  622. XDG env var <https://specifications.freedesktop.org/basedir-spec/0.6/ar01s03.html>
  623. \fBXDG_RUNTIME_DIR\fP is set, then \fB$XDG_RUNTIME_DIR/borg\fP is being used instead.
  624. This directory contains borg runtime files, like e.g. the socket file.
  625. .TP
  626. .B BORG_SECURITY_DIR
  627. Defaults to \fB$BORG_DATA_DIR/security\fP\&.
  628. This directory contains security relevant data.
  629. .TP
  630. .B BORG_KEYS_DIR
  631. Defaults to \fB$BORG_CONFIG_DIR/keys\fP\&.
  632. This directory contains keys for encrypted repositories.
  633. .TP
  634. .B BORG_KEY_FILE
  635. When set, use the given path as repository key file. Please note that this is only
  636. for rather special applications that externally fully manage the key files:
  637. .INDENT 7.0
  638. .IP \(bu 2
  639. this setting only applies to the keyfile modes (not to the repokey modes).
  640. .IP \(bu 2
  641. using a full, absolute path to the key file is recommended.
  642. .IP \(bu 2
  643. all directories in the given path must exist.
  644. .IP \(bu 2
  645. this setting forces borg to use the key file at the given location.
  646. .IP \(bu 2
  647. the key file must either exist (for most commands) or will be created (\fBborg repo\-create\fP).
  648. .IP \(bu 2
  649. you need to give a different path for different repositories.
  650. .IP \(bu 2
  651. you need to point to the correct key file matching the repository the command will operate on.
  652. .UNINDENT
  653. .TP
  654. .B TMPDIR
  655. This is where temporary files are stored (might need a lot of temporary space for some
  656. operations), see tempfile <https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir>
  657. for details.
  658. .UNINDENT
  659. .TP
  660. .B Building:
  661. .INDENT 7.0
  662. .TP
  663. .B BORG_OPENSSL_NAME
  664. Defines the subdirectory name for OpenSSL (setup.py).
  665. .TP
  666. .B BORG_OPENSSL_PREFIX
  667. Adds given OpenSSL header file directory to the default locations (setup.py).
  668. .TP
  669. .B BORG_LIBACL_PREFIX
  670. Adds given prefix directory to the default locations. If an \(aqinclude/acl/libacl.h\(aq is found
  671. Borg will be linked against the system libacl instead of a bundled implementation. (setup.py)
  672. .TP
  673. .B BORG_LIBLZ4_PREFIX
  674. Adds given prefix directory to the default locations. If a \(aqinclude/lz4.h\(aq is found Borg
  675. will be linked against the system liblz4 instead of a bundled implementation. (setup.py)
  676. .TP
  677. .B BORG_LIBZSTD_PREFIX
  678. Adds given prefix directory to the default locations. If a \(aqinclude/zstd.h\(aq is found Borg
  679. will be linked against the system libzstd instead of a bundled implementation. (setup.py)
  680. .UNINDENT
  681. .UNINDENT
  682. .sp
  683. Please note:
  684. .INDENT 0.0
  685. .IP \(bu 2
  686. Be very careful when using the \(dqyes\(dq sayers, the warnings with prompt exist for your / your data\(aqs security/safety.
  687. .IP \(bu 2
  688. Also be very careful when putting your passphrase into a script, make sure it has appropriate file permissions (e.g.
  689. mode 600, root:root).
  690. .UNINDENT
  691. .SS File systems
  692. .sp
  693. We recommend using a reliable, scalable journaling filesystem for the
  694. repository, e.g., zfs, btrfs, ext4, apfs.
  695. .sp
  696. Borg now uses the \fBborgstore\fP package to implement the key/value store it
  697. uses for the repository.
  698. .sp
  699. It currently uses the \fBfile:\fP store (posixfs backend) either with a local
  700. directory or via SSH and a remote \fBborg serve\fP agent using borgstore on the
  701. remote side.
  702. .sp
  703. This means that it will store each chunk into a separate filesystem file
  704. (for more details, see the \fBborgstore\fP project).
  705. .sp
  706. This has some pros and cons (compared to legacy Borg 1.x segment files):
  707. .sp
  708. Pros:
  709. .INDENT 0.0
  710. .IP \(bu 2
  711. Simplicity and better maintainability of the Borg code.
  712. .IP \(bu 2
  713. Sometimes faster, less I/O, better scalability: e.g., borg compact can just
  714. remove unused chunks by deleting a single file and does not need to read
  715. and rewrite segment files to free space.
  716. .IP \(bu 2
  717. In the future, easier to adapt to other kinds of storage:
  718. borgstore\(aqs backends are quite simple to implement.
  719. \fBsftp:\fP and \fBrclone:\fP backends already exist, others might be easy to add.
  720. .IP \(bu 2
  721. Parallel repository access with less locking is easier to implement.
  722. .UNINDENT
  723. .sp
  724. Cons:
  725. .INDENT 0.0
  726. .IP \(bu 2
  727. The repository filesystem will have to deal with a large number of files (there
  728. are provisions in borgstore against having too many files in a single directory
  729. by using a nested directory structure).
  730. .IP \(bu 2
  731. Greater filesystem space overhead (depends on the allocation block size — modern
  732. filesystems like zfs are rather clever here, using a variable block size).
  733. .IP \(bu 2
  734. Sometimes slower, due to less sequential and more random access operations.
  735. .UNINDENT
  736. .SS Units
  737. .sp
  738. To display quantities, Borg takes care of respecting the
  739. usual conventions of scale. Disk sizes are displayed in decimal <https://en.wikipedia.org/wiki/Decimal>
  740. , using powers of ten (so
  741. \fBkB\fP means 1000 bytes). For memory usage, binary prefixes <https://en.wikipedia.org/wiki/Binary_prefix>
  742. are used, and are
  743. indicated using the IEC binary prefixes <https://en.wikipedia.org/wiki/IEC_80000-13#Prefixes_for_binary_multiples>
  744. ,
  745. using powers of two (so \fBKiB\fP means 1024 bytes).
  746. .SS Date and Time
  747. .sp
  748. We format date and time in accordance with ISO 8601, that is: YYYY\-MM\-DD and
  749. HH:MM:SS (24\-hour clock).
  750. .sp
  751. For more information, see: <https://xkcd.com/1179/>
  752. .sp
  753. Unless otherwise noted, we display local date and time.
  754. Internally, we store and process date and time as UTC.
  755. TIMESPAN
  756. .sp
  757. Some options accept a TIMESPAN parameter, which can be given as a number of
  758. years (e.g. \fB2y\fP), months (e.g. \fB12m\fP), weeks (e.g. \fB2w\fP),
  759. days (e.g. \fB7d\fP), hours (e.g. \fB8H\fP), minutes (e.g. \fB30M\fP),
  760. or seconds (e.g. \fB150S\fP).
  761. .SS Resource Usage
  762. .sp
  763. Borg might use significant resources depending on the size of the data set it is dealing with.
  764. .sp
  765. If you use Borg in a client/server way (with an SSH repository),
  766. the resource usage occurs partly on the client and partly on the
  767. server.
  768. .sp
  769. If you use Borg as a single process (with a filesystem repository),
  770. all resource usage occurs in that one process, so add up client and
  771. server to get the approximate resource usage.
  772. .INDENT 0.0
  773. .TP
  774. .B CPU client:
  775. .INDENT 7.0
  776. .IP \(bu 2
  777. \fBborg create:\fP chunking, hashing, compression, encryption (high CPU usage)
  778. .IP \(bu 2
  779. \fBchunks cache sync:\fP quite heavy on CPU, doing lots of hash table operations
  780. .IP \(bu 2
  781. \fBborg extract:\fP decryption, decompression (medium to high CPU usage)
  782. .IP \(bu 2
  783. \fBborg check:\fP similar to extract, but depends on options given
  784. .IP \(bu 2
  785. \fBborg prune/borg delete archive:\fP low to medium CPU usage
  786. .IP \(bu 2
  787. \fBborg delete repo:\fP done on the server
  788. .UNINDENT
  789. .sp
  790. It will not use more than 100% of one CPU core as the code is currently single\-threaded.
  791. Especially higher zlib and lzma compression levels use significant amounts
  792. of CPU cycles. Crypto might be cheap on the CPU (if hardware\-accelerated) or
  793. expensive (if not).
  794. .TP
  795. .B CPU server:
  796. It usually does not need much CPU; it just deals with the key/value store
  797. (repository) and uses the repository index for that.
  798. .sp
  799. borg check: the repository check computes the checksums of all chunks
  800. (medium CPU usage)
  801. borg delete repo: low CPU usage
  802. .TP
  803. .B CPU (only for client/server operation):
  804. When using Borg in a client/server way with an ssh\-type repository, the SSH
  805. processes used for the transport layer will need some CPU on the client and
  806. on the server due to the crypto they are doing — especially if you are pumping
  807. large amounts of data.
  808. .TP
  809. .B Memory (RAM) client:
  810. The chunks index and the files index are read into memory for performance
  811. reasons. Might need large amounts of memory (see below).
  812. Compression, especially lzma compression with high levels, might need substantial
  813. amounts of memory.
  814. .TP
  815. .B Memory (RAM) server:
  816. The server process will load the repository index into memory. Might need
  817. considerable amounts of memory, but less than on the client (see below).
  818. .TP
  819. .B Chunks index (client only):
  820. Proportional to the number of data chunks in your repo. Lots of chunks
  821. in your repo imply a big chunks index.
  822. It is possible to tweak the chunker parameters (see create options).
  823. .TP
  824. .B Files index (client only):
  825. Proportional to the number of files in your last backups. Can be switched
  826. off (see create options), but the next backup might be much slower if you do.
  827. The speed benefit of using the files cache is proportional to file size.
  828. .TP
  829. .B Repository index (server only):
  830. Proportional to the number of data chunks in your repo. Lots of chunks
  831. in your repo imply a big repository index.
  832. It is possible to tweak the chunker parameters (see create options) to
  833. influence the number of chunks created.
  834. .TP
  835. .B Temporary files (client):
  836. Reading data and metadata from a FUSE\-mounted repository will consume up to
  837. the size of all deduplicated, small chunks in the repository. Big chunks
  838. will not be locally cached.
  839. .TP
  840. .B Temporary files (server):
  841. A non\-trivial amount of data will be stored in the remote temporary directory
  842. for each client that connects to it. For some remotes, this can fill the
  843. default temporary directory in /tmp. This can be mitigated by ensuring the
  844. $TMPDIR, $TEMP, or $TMP environment variable is properly set for the sshd
  845. process.
  846. For some OSes, this can be done by setting the correct value in the
  847. \&.bashrc (or equivalent login config file for other shells); however, in
  848. other cases it may be necessary to first enable \fBPermitUserEnvironment yes\fP
  849. in your \fBsshd_config\fP file, then add \fBenvironment=\(dqTMPDIR=/my/big/tmpdir\(dq\fP
  850. at the start of the public key to be used in the \fBauthorized_keys\fP file.
  851. .TP
  852. .B Cache files (client only):
  853. Contains the chunks index and files index (plus a collection of single\-
  854. archive chunk indexes), which might need huge amounts of disk space
  855. depending on archive count and size — see the FAQ for how to reduce this.
  856. .TP
  857. .B Network (only for client/server operation):
  858. If your repository is remote, all deduplicated (and optionally compressed/
  859. encrypted) data has to go over the connection (\fBssh://\fP repository URL).
  860. If you use a locally mounted network filesystem, some additional copy
  861. operations used for transaction support also go over the connection. If
  862. you back up multiple sources to one target repository, additional traffic
  863. happens for cache resynchronization.
  864. .UNINDENT
  865. .SS Support for file metadata
  866. .sp
  867. Besides regular file and directory structures, Borg can preserve
  868. .INDENT 0.0
  869. .IP \(bu 2
  870. symlinks (stored as a symlink; the symlink is not followed)
  871. .IP \(bu 2
  872. special files:
  873. .INDENT 2.0
  874. .IP \(bu 2
  875. character and block device files (restored via mknod(2))
  876. .IP \(bu 2
  877. FIFOs (\(dqnamed pipes\(dq)
  878. .IP \(bu 2
  879. special file \fIcontents\fP can be backed up in \fB\-\-read\-special\fP mode.
  880. By default, the metadata to create them with mknod(2), mkfifo(2), etc. is stored.
  881. .UNINDENT
  882. .IP \(bu 2
  883. hard\-linked regular files, devices, symlinks, FIFOs (considering all items in the same archive)
  884. .IP \(bu 2
  885. timestamps with nanosecond precision: mtime, atime, ctime
  886. .IP \(bu 2
  887. other timestamps: birthtime (on platforms supporting it)
  888. .IP \(bu 2
  889. permissions:
  890. .INDENT 2.0
  891. .IP \(bu 2
  892. IDs of owning user and owning group
  893. .IP \(bu 2
  894. names of owning user and owning group (if the IDs can be resolved)
  895. .IP \(bu 2
  896. Unix Mode/Permissions (u/g/o permissions, suid, sgid, sticky)
  897. .UNINDENT
  898. .UNINDENT
  899. .sp
  900. On some platforms additional features are supported:
  901. .\" Yes/No's are grouped by reason/mechanism/reference.
  902. .
  903. .TS
  904. box center;
  905. l|l|l|l.
  906. T{
  907. Platform
  908. T} T{
  909. ACLs
  910. [5]
  911. T} T{
  912. xattr
  913. [6]
  914. T} T{
  915. Flags
  916. [7]
  917. T}
  918. _
  919. T{
  920. Linux
  921. T} T{
  922. Yes
  923. T} T{
  924. Yes
  925. T} T{
  926. Yes [1]
  927. T}
  928. _
  929. T{
  930. macOS
  931. T} T{
  932. Yes
  933. T} T{
  934. Yes
  935. T} T{
  936. Yes (all)
  937. T}
  938. _
  939. T{
  940. FreeBSD
  941. T} T{
  942. Yes
  943. T} T{
  944. Yes
  945. T} T{
  946. Yes (all)
  947. T}
  948. _
  949. T{
  950. OpenBSD
  951. T} T{
  952. n/a
  953. T} T{
  954. n/a
  955. T} T{
  956. Yes (all)
  957. T}
  958. _
  959. T{
  960. NetBSD
  961. T} T{
  962. n/a
  963. T} T{
  964. No [2]
  965. T} T{
  966. Yes (all)
  967. T}
  968. _
  969. T{
  970. Solaris and derivatives
  971. T} T{
  972. No [3]
  973. T} T{
  974. No [3]
  975. T} T{
  976. n/a
  977. T}
  978. _
  979. T{
  980. Windows (cygwin)
  981. T} T{
  982. No [4]
  983. T} T{
  984. No
  985. T} T{
  986. No
  987. T}
  988. .TE
  989. .sp
  990. Other Unix\-like operating systems may work as well, but have not been tested yet.
  991. .sp
  992. Note that most platform\-dependent features also depend on the filesystem.
  993. For example, ntfs\-3g on Linux is not able to convey NTFS ACLs.
  994. .IP [1] 5
  995. Only \(dqnodump\(dq, \(dqimmutable\(dq, \(dqcompressed\(dq and \(dqappend\(dq are supported.
  996. Feature request #618 for more flags.
  997. .IP [2] 5
  998. Feature request #1332
  999. .IP [3] 5
  1000. Feature request #1337
  1001. .IP [4] 5
  1002. Cygwin tries to map NTFS ACLs to permissions with varying degrees of success.
  1003. .IP [5] 5
  1004. The native access control list mechanism of the OS. This normally limits access to
  1005. non\-native ACLs. For example, NTFS ACLs are not completely accessible on Linux with ntfs\-3g.
  1006. .IP [6] 5
  1007. Extended attributes; key\-value pairs attached to a file, mainly used by the OS.
  1008. This includes resource forks on macOS.
  1009. .IP [7] 5
  1010. Also known as \fIBSD flags\fP\&. The Linux set of flags [1] is portable across platforms.
  1011. The BSDs define additional flags.
  1012. .SH SEE ALSO
  1013. .sp
  1014. \fIborg\-common(1)\fP for common command line options
  1015. .sp
  1016. \fIborg\-repo\-create(1)\fP, \fIborg\-repo\-delete(1)\fP, \fIborg\-repo\-list(1)\fP, \fIborg\-repo\-info(1)\fP,
  1017. \fIborg\-create(1)\fP, \fIborg\-mount(1)\fP, \fIborg\-extract(1)\fP,
  1018. \fIborg\-list(1)\fP, \fIborg\-info(1)\fP,
  1019. \fIborg\-delete(1)\fP, \fIborg\-prune(1)\fP, \fIborg\-compact(1)\fP,
  1020. \fIborg\-recreate(1)\fP
  1021. .sp
  1022. \fIborg\-compression(1)\fP, \fIborg\-patterns(1)\fP, \fIborg\-placeholders(1)\fP
  1023. .INDENT 0.0
  1024. .IP \(bu 2
  1025. Main web site <https://www.borgbackup.org/>
  1026. .IP \(bu 2
  1027. Releases <https://github.com/borgbackup/borg/releases>
  1028. .IP \(bu 2
  1029. Changelog <https://github.com/borgbackup/borg/blob/master/docs/changes.rst>
  1030. .IP \(bu 2
  1031. GitHub <https://github.com/borgbackup/borg>
  1032. .IP \(bu 2
  1033. Security contact <https://borgbackup.readthedocs.io/en/latest/support.html#security\-contact>
  1034. .UNINDENT
  1035. .SH AUTHOR
  1036. The Borg Collective
  1037. orphan:
  1038. .\" Generated by docutils manpage writer.
  1039. .