borg.1 33 KB

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