2
0

borg.1 34 KB

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