borg.1 34 KB

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