borg.1 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  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 "" "" "" ""
  31. .SH NAME
  32. \-
  33. .SH BORG
  34. .SS deduplicating and encrypting backup tool
  35. .INDENT 0.0
  36. .TP
  37. .B Author
  38. The Borg Collective
  39. .TP
  40. .B Date
  41. 2017\-02\-05
  42. .TP
  43. .B Manual section
  44. 1
  45. .TP
  46. .B Manual group
  47. borg backup tool
  48. .UNINDENT
  49. .SS SYNOPSIS
  50. .sp
  51. borg [common options] <command> [options] [arguments]
  52. .SS DESCRIPTION
  53. .\" we don't include the README.rst here since we want to keep this terse.
  54. .
  55. .sp
  56. BorgBackup (short: Borg) is a deduplicating backup program.
  57. Optionally, it supports compression and authenticated encryption.
  58. .sp
  59. The main goal of Borg is to provide an efficient and secure way to backup data.
  60. The data deduplication technique used makes Borg suitable for daily backups
  61. since only changes are stored.
  62. The authenticated encryption technique makes it suitable for backups to not
  63. fully trusted targets.
  64. .sp
  65. Borg stores a set of files in an \fIarchive\fP\&. A \fIrepository\fP is a collection
  66. of \fIarchives\fP\&. The format of repositories is Borg\-specific. Borg does not
  67. distinguish archives from each other in any way other than their name,
  68. it does not matter when or where archives were created (e.g. different hosts).
  69. .SS EXAMPLES
  70. .SS A step\-by\-step example
  71. .INDENT 0.0
  72. .IP 1. 3
  73. Before a backup can be made a repository has to be initialized:
  74. .INDENT 3.0
  75. .INDENT 3.5
  76. .sp
  77. .nf
  78. .ft C
  79. $ borg init \-\-encryption=repokey /path/to/repo
  80. .ft P
  81. .fi
  82. .UNINDENT
  83. .UNINDENT
  84. .IP 2. 3
  85. Backup the \fB~/src\fP and \fB~/Documents\fP directories into an archive called
  86. \fIMonday\fP:
  87. .INDENT 3.0
  88. .INDENT 3.5
  89. .sp
  90. .nf
  91. .ft C
  92. $ borg create /path/to/repo::Monday ~/src ~/Documents
  93. .ft P
  94. .fi
  95. .UNINDENT
  96. .UNINDENT
  97. .IP 3. 3
  98. The next day create a new archive called \fITuesday\fP:
  99. .INDENT 3.0
  100. .INDENT 3.5
  101. .sp
  102. .nf
  103. .ft C
  104. $ borg create \-\-stats /path/to/repo::Tuesday ~/src ~/Documents
  105. .ft P
  106. .fi
  107. .UNINDENT
  108. .UNINDENT
  109. .sp
  110. This backup will be a lot quicker and a lot smaller since only new never
  111. before seen data is stored. The \fB\-\-stats\fP option causes Borg to
  112. output statistics about the newly created archive such as the amount of unique
  113. data (not shared with other archives):
  114. .INDENT 3.0
  115. .INDENT 3.5
  116. .sp
  117. .nf
  118. .ft C
  119. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
  120. Archive name: Tuesday
  121. Archive fingerprint: bd31004d58f51ea06ff735d2e5ac49376901b21d58035f8fb05dbf866566e3c2
  122. Time (start): Tue, 2016\-02\-16 18:15:11
  123. Time (end): Tue, 2016\-02\-16 18:15:11
  124. Duration: 0.19 seconds
  125. Number of files: 127
  126. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
  127. Original size Compressed size Deduplicated size
  128. This archive: 4.16 MB 4.17 MB 26.78 kB
  129. All archives: 8.33 MB 8.34 MB 4.19 MB
  130. Unique chunks Total chunks
  131. Chunk index: 132 261
  132. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
  133. .ft P
  134. .fi
  135. .UNINDENT
  136. .UNINDENT
  137. .IP 4. 3
  138. List all archives in the repository:
  139. .INDENT 3.0
  140. .INDENT 3.5
  141. .sp
  142. .nf
  143. .ft C
  144. $ borg list /path/to/repo
  145. Monday Mon, 2016\-02\-15 19:14:44
  146. Tuesday Tue, 2016\-02\-16 19:15:11
  147. .ft P
  148. .fi
  149. .UNINDENT
  150. .UNINDENT
  151. .IP 5. 3
  152. List the contents of the \fIMonday\fP archive:
  153. .INDENT 3.0
  154. .INDENT 3.5
  155. .sp
  156. .nf
  157. .ft C
  158. $ borg list /path/to/repo::Monday
  159. drwxr\-xr\-x user group 0 Mon, 2016\-02\-15 18:22:30 home/user/Documents
  160. \-rw\-r\-\-r\-\- user group 7961 Mon, 2016\-02\-15 18:22:30 home/user/Documents/Important.doc
  161. \&...
  162. .ft P
  163. .fi
  164. .UNINDENT
  165. .UNINDENT
  166. .IP 6. 3
  167. Restore the \fIMonday\fP archive by extracting the files relative to the current directory:
  168. .INDENT 3.0
  169. .INDENT 3.5
  170. .sp
  171. .nf
  172. .ft C
  173. $ borg extract /path/to/repo::Monday
  174. .ft P
  175. .fi
  176. .UNINDENT
  177. .UNINDENT
  178. .IP 7. 3
  179. Recover disk space by manually deleting the \fIMonday\fP archive:
  180. .INDENT 3.0
  181. .INDENT 3.5
  182. .sp
  183. .nf
  184. .ft C
  185. $ borg delete /path/to/repo::Monday
  186. .ft P
  187. .fi
  188. .UNINDENT
  189. .UNINDENT
  190. .UNINDENT
  191. .sp
  192. \fBNOTE:\fP
  193. .INDENT 0.0
  194. .INDENT 3.5
  195. Borg is quiet by default (it works on WARNING log level).
  196. You can use options like \fB\-\-progress\fP or \fB\-\-list\fP to get specific
  197. reports during command execution. You can also add the \fB\-v\fP (or
  198. \fB\-\-verbose\fP or \fB\-\-info\fP) option to adjust the log level to INFO to
  199. get other informational messages.
  200. .UNINDENT
  201. .UNINDENT
  202. .SS NOTES
  203. .SS Positional Arguments and Options: Order matters
  204. .sp
  205. Borg only supports taking options (\fB\-s\fP and \fB\-\-progress\fP in the example)
  206. to the left or right of all positional arguments (\fBrepo::archive\fP and \fBpath\fP
  207. in the example), but not in between them:
  208. .INDENT 0.0
  209. .INDENT 3.5
  210. .sp
  211. .nf
  212. .ft C
  213. borg create \-s \-\-progress repo::archive path # good and preferred
  214. borg create repo::archive path \-s \-\-progress # also works
  215. borg create \-s repo::archive path \-\-progress # works, but ugly
  216. borg create repo::archive \-s \-\-progress path # BAD
  217. .ft P
  218. .fi
  219. .UNINDENT
  220. .UNINDENT
  221. .sp
  222. This is due to a problem in the argparse module: \fI\%https://bugs.python.org/issue15112\fP
  223. .SS Repository URLs
  224. .sp
  225. \fBLocal filesystem\fP (or locally mounted network filesystem):
  226. .sp
  227. \fB/path/to/repo\fP \- filesystem path to repo directory, absolute path
  228. .sp
  229. \fBpath/to/repo\fP \- filesystem path to repo directory, relative path
  230. .sp
  231. Also, stuff like \fB~/path/to/repo\fP or \fB~other/path/to/repo\fP works (this is
  232. expanded by your shell).
  233. .sp
  234. Note: you may also prepend a \fBfile://\fP to a filesystem path to get URL style.
  235. .sp
  236. \fBRemote repositories\fP accessed via ssh \fI\%user@host\fP:
  237. .sp
  238. \fBuser@host:/path/to/repo\fP \- remote repo, absolute path
  239. .sp
  240. \fBssh://user@host:port/path/to/repo\fP \- same, alternative syntax, port can be given
  241. .sp
  242. \fBRemote repositories with relative paths\fP can be given using this syntax:
  243. .sp
  244. \fBuser@host:path/to/repo\fP \- path relative to current directory
  245. .sp
  246. \fBuser@host:~/path/to/repo\fP \- path relative to user\(aqs home directory
  247. .sp
  248. \fBuser@host:~other/path/to/repo\fP \- path relative to other\(aqs home directory
  249. .sp
  250. Note: giving \fBuser@host:/./path/to/repo\fP or \fBuser@host:/~/path/to/repo\fP or
  251. \fBuser@host:/~other/path/to/repo\fP is also supported, but not required here.
  252. .sp
  253. \fBRemote repositories with relative paths, alternative syntax with port\fP:
  254. .sp
  255. \fBssh://user@host:port/./path/to/repo\fP \- path relative to current directory
  256. .sp
  257. \fBssh://user@host:port/~/path/to/repo\fP \- path relative to user\(aqs home directory
  258. .sp
  259. \fBssh://user@host:port/~other/path/to/repo\fP \- path relative to other\(aqs home directory
  260. .sp
  261. If you frequently need the same repo URL, it is a good idea to set the
  262. \fBBORG_REPO\fP environment variable to set a default for the repo URL:
  263. .INDENT 0.0
  264. .INDENT 3.5
  265. .sp
  266. .nf
  267. .ft C
  268. export BORG_REPO=\(aqssh://user@host:port/path/to/repo\(aq
  269. .ft P
  270. .fi
  271. .UNINDENT
  272. .UNINDENT
  273. .sp
  274. Then just leave away the repo URL if only a repo URL is needed and you want
  275. to use the default \- it will be read from BORG_REPO then.
  276. .sp
  277. Use \fB::\fP syntax to give the repo URL when syntax requires giving a positional
  278. argument for the repo (e.g. \fBborg mount :: /mnt\fP).
  279. .SS Repository / Archive Locations
  280. .sp
  281. Many commands want either a repository (just give the repo URL, see above) or
  282. an archive location, which is a repo URL followed by \fB::archive_name\fP\&.
  283. .sp
  284. Archive names must not contain the \fB/\fP (slash) character. For simplicity,
  285. maybe also avoid blanks or other characters that have special meaning on the
  286. shell or in a filesystem (borg mount will use the archive name as directory
  287. name).
  288. .sp
  289. If you have set BORG_REPO (see above) and an archive location is needed, use
  290. \fB::archive_name\fP \- the repo URL part is then read from BORG_REPO.
  291. .SS Logging
  292. .sp
  293. Borg writes all log output to stderr by default. But please note that something
  294. showing up on stderr does \fInot\fP indicate an error condition just because it is
  295. on stderr. Please check the log levels of the messages and the return code of
  296. borg for determining error, warning or success conditions.
  297. .sp
  298. If you want to capture the log output to a file, just redirect it:
  299. .INDENT 0.0
  300. .INDENT 3.5
  301. .sp
  302. .nf
  303. .ft C
  304. borg create repo::archive myfiles 2>> logfile
  305. .ft P
  306. .fi
  307. .UNINDENT
  308. .UNINDENT
  309. .sp
  310. Custom logging configurations can be implemented via BORG_LOGGING_CONF.
  311. .sp
  312. The log level of the builtin logging configuration defaults to WARNING.
  313. This is because we want Borg to be mostly silent and only output
  314. warnings, errors and critical messages, unless output has been requested
  315. by supplying an option that implies output (e.g. \fB\-\-list\fP or \fB\-\-progress\fP).
  316. .sp
  317. Log levels: DEBUG < INFO < WARNING < ERROR < CRITICAL
  318. .sp
  319. Use \fB\-\-debug\fP to set DEBUG log level \-
  320. to get debug, info, warning, error and critical level output.
  321. .sp
  322. Use \fB\-\-info\fP (or \fB\-v\fP or \fB\-\-verbose\fP) to set INFO log level \-
  323. to get info, warning, error and critical level output.
  324. .sp
  325. Use \fB\-\-warning\fP (default) to set WARNING log level \-
  326. to get warning, error and critical level output.
  327. .sp
  328. Use \fB\-\-error\fP to set ERROR log level \-
  329. to get error and critical level output.
  330. .sp
  331. Use \fB\-\-critical\fP to set CRITICAL log level \-
  332. to get critical level output.
  333. .sp
  334. While you can set misc. log levels, do not expect that every command will
  335. give different output on different log levels \- it\(aqs just a possibility.
  336. .sp
  337. \fBWARNING:\fP
  338. .INDENT 0.0
  339. .INDENT 3.5
  340. Options \fB\-\-critical\fP and \fB\-\-error\fP are provided for completeness,
  341. their usage is not recommended as you might miss important information.
  342. .UNINDENT
  343. .UNINDENT
  344. .SS Return codes
  345. .sp
  346. Borg can exit with the following return codes (rc):
  347. .TS
  348. center;
  349. |l|l|.
  350. _
  351. T{
  352. Return code
  353. T} T{
  354. Meaning
  355. T}
  356. _
  357. T{
  358. 0
  359. T} T{
  360. success (logged as INFO)
  361. T}
  362. _
  363. T{
  364. 1
  365. T} T{
  366. warning (operation reached its normal end, but there were warnings \-\-
  367. you should check the log, logged as WARNING)
  368. T}
  369. _
  370. T{
  371. 2
  372. T} T{
  373. error (like a fatal error, a local or remote exception, the operation
  374. did not reach its normal end, logged as ERROR)
  375. T}
  376. _
  377. T{
  378. 128+N
  379. T} T{
  380. killed by signal N (e.g. 137 == kill \-9)
  381. T}
  382. _
  383. .TE
  384. .sp
  385. If you use \fB\-\-show\-rc\fP, the return code is also logged at the indicated
  386. level as the last log entry.
  387. .SS Environment Variables
  388. .sp
  389. Borg uses some environment variables for automation:
  390. .INDENT 0.0
  391. .TP
  392. .B General:
  393. .INDENT 7.0
  394. .TP
  395. .B BORG_REPO
  396. When set, use the value to give the default repository location. If a command needs an archive
  397. parameter, you can abbreviate as \fB::archive\fP\&. If a command needs a repository parameter, you
  398. can either leave it away or abbreviate as \fB::\fP, if a positional parameter is required.
  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 fully automate \fBborg change\-passphrase\fP\&.
  428. .TP
  429. .B BORG_DISPLAY_PASSPHRASE
  430. When set, use the value to answer the "display the passphrase for verification" question when defining a new passphrase for encrypted repositories.
  431. .TP
  432. .B BORG_HOSTNAME_IS_UNIQUE=no
  433. Borg assumes that it can derive a unique hostname / identity (see \fBborg debug info\fP).
  434. If this is not the case or you do not want Borg to automatically remove stale locks,
  435. set this to \fIno\fP\&.
  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 better externally control 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_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 "borg" 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 "time to live" for the files cache
  465. entries (default: 20). The files cache is used to quickly determine whether a file is unchanged.
  466. The FAQ explains this more detailed in: \fIalways_chunking\fP
  467. .TP
  468. .B BORG_SHOW_SYSINFO
  469. When set to no (default: yes), system information (like OS, Python version, ...) in
  470. exceptions is not shown.
  471. Please only use for good reasons as it makes issues harder to analyze.
  472. .TP
  473. .B BORG_LIBC
  474. borg uses \fBctypes.util.find_library\fP to locate the \(aqc\(aq library (aka libc).
  475. find_library needs a shell and will invoke some tools like ldconfig, gcc/cc or objdump.
  476. If a shell or these tools are not available, you can give the name of your libc via
  477. BORG_LIBC=libc.so.6 (for example) and borg will not try the \fBfind_library\fP call.
  478. .TP
  479. .B BORG_SELFTEST
  480. This can be used to influence borg\(aqs builtin self\-tests. The default is to execute the tests
  481. at the beginning of each borg command invocation.
  482. .sp
  483. BORG_SELFTEST=disabled can be used to switch off the tests and rather save some time.
  484. Disabling is not recommended for normal borg users, but large scale borg storage providers can
  485. use this to optimize production servers after at least doing a one\-time test borg (with
  486. selftests not disabled) when installing or upgrading machines / OS / borg.
  487. .TP
  488. .B BORG_WORKAROUNDS
  489. A list of comma separated strings that trigger workarounds in borg,
  490. e.g. to work around bugs in other software.
  491. .sp
  492. Currently known strings are:
  493. .INDENT 7.0
  494. .TP
  495. .B basesyncfile
  496. Use the more simple BaseSyncFile code to avoid issues with sync_file_range.
  497. You might need this to run borg on WSL (Windows Subsystem for Linux) or
  498. in systemd.nspawn containers on some architectures (e.g. ARM).
  499. Using this does not affect data safety, but might result in a more bursty
  500. write to disk behaviour (not continuously streaming to disk).
  501. .TP
  502. .B retry_erofs
  503. Retry opening a file without O_NOATIME if opening a file with O_NOATIME
  504. caused EROFS. You will need this to make archives from volume shadow copies
  505. in WSL1 (Windows Subsystem for Linux 1).
  506. .UNINDENT
  507. .UNINDENT
  508. .TP
  509. .B Some automatic "answerers" (if set, they automatically answer confirmation questions):
  510. .INDENT 7.0
  511. .TP
  512. .B BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no (or =yes)
  513. For "Warning: Attempting to access a previously unknown unencrypted repository"
  514. .TP
  515. .B BORG_RELOCATED_REPO_ACCESS_IS_OK=no (or =yes)
  516. For "Warning: The repository at location ... was previously located at ..."
  517. .TP
  518. .B BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=NO (or =YES)
  519. For "This is a potentially dangerous function..." (check \-\-repair)
  520. .TP
  521. .B BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO (or =YES)
  522. For "You requested to completely DELETE the repository \fIincluding\fP all archives it contains:"
  523. .UNINDENT
  524. .sp
  525. Note: answers are case sensitive. setting an invalid answer value might either give the default
  526. answer or ask you interactively, depending on whether retries are allowed (they by default are
  527. allowed). So please test your scripts interactively before making them a non\-interactive script.
  528. .UNINDENT
  529. .INDENT 0.0
  530. .TP
  531. .B Directories and files:
  532. .INDENT 7.0
  533. .TP
  534. .B BORG_BASE_DIR
  535. Defaults to \fB$HOME\fP or \fB~$USER\fP or \fB~\fP (in that order).
  536. If you want to move all borg\-specific folders to a custom path at once, all you need to do is
  537. to modify \fBBORG_BASE_DIR\fP: the other paths for cache, config etc. will adapt accordingly
  538. (assuming you didn\(aqt set them to a different custom value).
  539. .TP
  540. .B BORG_CACHE_DIR
  541. Defaults to \fB$BORG_BASE_DIR/.cache/borg\fP\&. If \fBBORG_BASE_DIR\fP is not explicitly set while
  542. \fI\%XDG env var\fP \fBXDG_CACHE_HOME\fP is set, then \fB$XDG_CACHE_HOME/borg\fP is being used instead.
  543. This directory contains the local cache and might need a lot
  544. of space for dealing with big repositories. Make sure you\(aqre aware of the associated
  545. security aspects of the cache location: \fIcache_security\fP
  546. .TP
  547. .B BORG_CONFIG_DIR
  548. Defaults to \fB$BORG_BASE_DIR/.config/borg\fP\&. If \fBBORG_BASE_DIR\fP is not explicitly set while
  549. \fI\%XDG env var\fP \fBXDG_CONFIG_HOME\fP is set, then \fB$XDG_CONFIG_HOME/borg\fP is being used instead.
  550. This directory contains all borg configuration directories, see the FAQ
  551. for a security advisory about the data in this directory: \fIhome_config_borg\fP
  552. .TP
  553. .B BORG_SECURITY_DIR
  554. Defaults to \fB$BORG_CONFIG_DIR/security\fP\&.
  555. This directory contains information borg uses to track its usage of NONCES ("numbers used
  556. once" \- usually in encryption context) and other security relevant data.
  557. .TP
  558. .B BORG_KEYS_DIR
  559. Defaults to \fB$BORG_CONFIG_DIR/keys\fP\&.
  560. This directory contains keys for encrypted repositories.
  561. .TP
  562. .B BORG_KEY_FILE
  563. When set, use the given filename as repository key file.
  564. .TP
  565. .B TMPDIR
  566. This is where temporary files are stored (might need a lot of temporary space for some
  567. operations), see \fI\%tempfile\fP for details.
  568. .UNINDENT
  569. .TP
  570. .B Building:
  571. .INDENT 7.0
  572. .TP
  573. .B BORG_OPENSSL_PREFIX
  574. Adds given OpenSSL header file directory to the default locations (setup.py).
  575. .TP
  576. .B BORG_LIBLZ4_PREFIX
  577. Adds given prefix directory to the default locations. If a \(aqinclude/lz4.h\(aq is found Borg
  578. will be linked against the system liblz4 instead of a bundled implementation. (setup.py)
  579. .TP
  580. .B BORG_LIBB2_PREFIX
  581. Adds given prefix directory to the default locations. If a \(aqinclude/blake2.h\(aq is found Borg
  582. will be linked against the system libb2 instead of a bundled implementation. (setup.py)
  583. .TP
  584. .B BORG_LIBZSTD_PREFIX
  585. Adds given prefix directory to the default locations. If a \(aqinclude/zstd.h\(aq is found Borg
  586. will be linked against the system libzstd instead of a bundled implementation. (setup.py)
  587. .UNINDENT
  588. .UNINDENT
  589. .sp
  590. Please note:
  591. .INDENT 0.0
  592. .IP \(bu 2
  593. Be very careful when using the "yes" sayers, the warnings with prompt exist for your / your data\(aqs security/safety.
  594. .IP \(bu 2
  595. Also be very careful when putting your passphrase into a script, make sure it has appropriate file permissions (e.g.
  596. mode 600, root:root).
  597. .UNINDENT
  598. .SS File systems
  599. .sp
  600. We strongly recommend against using Borg (or any other database\-like
  601. software) on non\-journaling file systems like FAT, since it is not
  602. possible to assume any consistency in case of power failures (or a
  603. sudden disconnect of an external drive or similar failures).
  604. .sp
  605. While Borg uses a data store that is resilient against these failures
  606. when used on journaling file systems, it is not possible to guarantee
  607. this with some hardware \-\- independent of the software used. We don\(aqt
  608. know a list of affected hardware.
  609. .sp
  610. If you are suspicious whether your Borg repository is still consistent
  611. and readable after one of the failures mentioned above occurred, run
  612. \fBborg check \-\-verify\-data\fP to make sure it is consistent.
  613. Requirements for Borg repository file systems
  614. .INDENT 0.0
  615. .IP \(bu 2
  616. Long file names
  617. .IP \(bu 2
  618. At least three directory levels with short names
  619. .IP \(bu 2
  620. Typically, file sizes up to a few hundred MB.
  621. Large repositories may require large files (>2 GB).
  622. .IP \(bu 2
  623. Up to 1000 files per directory (10000 for repositories initialized with Borg 1.0)
  624. .IP \(bu 2
  625. mkdir(2) should be atomic, since it is used for locking
  626. .IP \(bu 2
  627. Hardlinks are needed for \fIborg_upgrade\fP (if \fB\-\-inplace\fP option is not used).
  628. Also hardlinks are used for more safe and secure file updating (e.g. of the repo
  629. config file), but the code tries to work also if hardlinks are not supported.
  630. .UNINDENT
  631. .SS Units
  632. .sp
  633. To display quantities, Borg takes care of respecting the
  634. usual conventions of scale. Disk sizes are displayed in \fI\%decimal\fP, using powers of ten (so
  635. \fBkB\fP means 1000 bytes). For memory usage, \fI\%binary prefixes\fP are used, and are
  636. indicated using the \fI\%IEC binary prefixes\fP,
  637. using powers of two (so \fBKiB\fP means 1024 bytes).
  638. .SS Date and Time
  639. .sp
  640. We format date and time conforming to ISO\-8601, that is: YYYY\-MM\-DD and
  641. HH:MM:SS (24h clock).
  642. .sp
  643. For more information about that, see: \fI\%https://xkcd.com/1179/\fP
  644. .sp
  645. Unless otherwise noted, we display local date and time.
  646. Internally, we store and process date and time as UTC.
  647. .SS Resource Usage
  648. .sp
  649. Borg might use a lot of resources depending on the size of the data set it is dealing with.
  650. .sp
  651. If one uses Borg in a client/server way (with a ssh: repository),
  652. the resource usage occurs in part on the client and in another part on the
  653. server.
  654. .sp
  655. If one uses Borg as a single process (with a filesystem repo),
  656. all the resource usage occurs in that one process, so just add up client +
  657. server to get the approximate resource usage.
  658. .INDENT 0.0
  659. .TP
  660. .B CPU client:
  661. .INDENT 7.0
  662. .IP \(bu 2
  663. \fBborg create:\fP does chunking, hashing, compression, crypto (high CPU usage)
  664. .IP \(bu 2
  665. \fBchunks cache sync:\fP quite heavy on CPU, doing lots of hashtable operations.
  666. .IP \(bu 2
  667. \fBborg extract:\fP crypto, decompression (medium to high CPU usage)
  668. .IP \(bu 2
  669. \fBborg check:\fP similar to extract, but depends on options given.
  670. .IP \(bu 2
  671. \fBborg prune / borg delete archive:\fP low to medium CPU usage
  672. .IP \(bu 2
  673. \fBborg delete repo:\fP done on the server
  674. .UNINDENT
  675. .sp
  676. It won\(aqt go beyond 100% of 1 core as the code is currently single\-threaded.
  677. Especially higher zlib and lzma compression levels use significant amounts
  678. of CPU cycles. Crypto might be cheap on the CPU (if hardware accelerated) or
  679. expensive (if not).
  680. .TP
  681. .B CPU server:
  682. It usually doesn\(aqt need much CPU, it just deals with the key/value store
  683. (repository) and uses the repository index for that.
  684. .sp
  685. borg check: the repository check computes the checksums of all chunks
  686. (medium CPU usage)
  687. borg delete repo: low CPU usage
  688. .TP
  689. .B CPU (only for client/server operation):
  690. When using borg in a client/server way with a \fI\%ssh:\-type\fP repo, the ssh
  691. processes used for the transport layer will need some CPU on the client and
  692. on the server due to the crypto they are doing \- esp. if you are pumping
  693. big amounts of data.
  694. .TP
  695. .B Memory (RAM) client:
  696. The chunks index and the files index are read into memory for performance
  697. reasons. Might need big amounts of memory (see below).
  698. Compression, esp. lzma compression with high levels might need substantial
  699. amounts of memory.
  700. .TP
  701. .B Memory (RAM) server:
  702. The server process will load the repository index into memory. Might need
  703. considerable amounts of memory, but less than on the client (see below).
  704. .TP
  705. .B Chunks index (client only):
  706. Proportional to the amount of data chunks in your repo. Lots of chunks
  707. in your repo imply a big chunks index.
  708. It is possible to tweak the chunker params (see create options).
  709. .TP
  710. .B Files index (client only):
  711. Proportional to the amount of files in your last backups. Can be switched
  712. off (see create options), but next backup might be much slower if you do.
  713. The speed benefit of using the files cache is proportional to file size.
  714. .TP
  715. .B Repository index (server only):
  716. Proportional to the amount of data chunks in your repo. Lots of chunks
  717. in your repo imply a big repository index.
  718. It is possible to tweak the chunker params (see create options) to
  719. influence the amount of chunks being created.
  720. .TP
  721. .B Temporary files (client):
  722. Reading data and metadata from a FUSE mounted repository will consume up to
  723. the size of all deduplicated, small chunks in the repository. Big chunks
  724. won\(aqt be locally cached.
  725. .TP
  726. .B Temporary files (server):
  727. A non\-trivial amount of data will be stored on the remote temp directory
  728. for each client that connects to it. For some remotes, this can fill the
  729. default temporary directory at /tmp. This can be remediated by ensuring the
  730. $TMPDIR, $TEMP, or $TMP environment variable is properly set for the sshd
  731. process.
  732. For some OSes, this can be done just by setting the correct value in the
  733. \&.bashrc (or equivalent login config file for other shells), however in
  734. other cases it may be necessary to first enable \fBPermitUserEnvironment yes\fP
  735. in your \fBsshd_config\fP file, then add \fBenvironment="TMPDIR=/my/big/tmpdir"\fP
  736. at the start of the public key to be used in the \fBauthorized_hosts\fP file.
  737. .TP
  738. .B Cache files (client only):
  739. Contains the chunks index and files index (plus a collection of single\-
  740. archive chunk indexes which might need huge amounts of disk space,
  741. depending on archive count and size \- see FAQ about how to reduce).
  742. .TP
  743. .B Network (only for client/server operation):
  744. If your repository is remote, all deduplicated (and optionally compressed/
  745. encrypted) data of course has to go over the connection (\fBssh://\fP repo url).
  746. If you use a locally mounted network filesystem, additionally some copy
  747. operations used for transaction support also go over the connection. If
  748. you backup multiple sources to one target repository, additional traffic
  749. happens for cache resynchronization.
  750. .UNINDENT
  751. .SS Support for file metadata
  752. .sp
  753. Besides regular file and directory structures, Borg can preserve
  754. .INDENT 0.0
  755. .IP \(bu 2
  756. symlinks (stored as symlink, the symlink is not followed)
  757. .IP \(bu 2
  758. special files:
  759. .INDENT 2.0
  760. .IP \(bu 2
  761. character and block device files (restored via mknod)
  762. .IP \(bu 2
  763. FIFOs ("named pipes")
  764. .IP \(bu 2
  765. special file \fIcontents\fP can be backed up in \fB\-\-read\-special\fP mode.
  766. By default the metadata to create them with mknod(2), mkfifo(2) etc. is stored.
  767. .UNINDENT
  768. .IP \(bu 2
  769. hardlinked regular files, devices, FIFOs (considering all items in the same archive)
  770. .IP \(bu 2
  771. timestamps in nanosecond precision: mtime, atime, ctime
  772. .IP \(bu 2
  773. other timestamps: birthtime (on platforms supporting it)
  774. .IP \(bu 2
  775. permissions:
  776. .INDENT 2.0
  777. .IP \(bu 2
  778. IDs of owning user and owning group
  779. .IP \(bu 2
  780. names of owning user and owning group (if the IDs can be resolved)
  781. .IP \(bu 2
  782. Unix Mode/Permissions (u/g/o permissions, suid, sgid, sticky)
  783. .UNINDENT
  784. .UNINDENT
  785. .sp
  786. On some platforms additional features are supported:
  787. .\" Yes/No's are grouped by reason/mechanism/reference.
  788. .
  789. .TS
  790. center;
  791. |l|l|l|l|.
  792. _
  793. T{
  794. Platform
  795. T} T{
  796. ACLs
  797. [5]
  798. T} T{
  799. xattr
  800. [6]
  801. T} T{
  802. Flags
  803. [7]
  804. T}
  805. _
  806. T{
  807. Linux
  808. T} T{
  809. Yes
  810. T} T{
  811. Yes
  812. T} T{
  813. Yes [1]
  814. T}
  815. _
  816. T{
  817. Mac OS X
  818. T} T{
  819. Yes
  820. T} T{
  821. Yes
  822. T} T{
  823. Yes (all)
  824. T}
  825. _
  826. T{
  827. FreeBSD
  828. T} T{
  829. Yes
  830. T} T{
  831. Yes
  832. T} T{
  833. Yes (all)
  834. T}
  835. _
  836. T{
  837. OpenBSD
  838. T} T{
  839. n/a
  840. T} T{
  841. n/a
  842. T} T{
  843. Yes (all)
  844. T}
  845. _
  846. T{
  847. NetBSD
  848. T} T{
  849. n/a
  850. T} T{
  851. No [2]
  852. T} T{
  853. Yes (all)
  854. T}
  855. _
  856. T{
  857. Solaris and derivatives
  858. T} T{
  859. No [3]
  860. T} T{
  861. No [3]
  862. T} T{
  863. n/a
  864. T}
  865. _
  866. T{
  867. Windows (cygwin)
  868. T} T{
  869. No [4]
  870. T} T{
  871. No
  872. T} T{
  873. No
  874. T}
  875. _
  876. .TE
  877. .sp
  878. Other Unix\-like operating systems may work as well, but have not been tested at all.
  879. .sp
  880. Note that most of the platform\-dependent features also depend on the file system.
  881. For example, ntfs\-3g on Linux isn\(aqt able to convey NTFS ACLs.
  882. .IP [1] 5
  883. Only "nodump", "immutable", "compressed" and "append" are supported.
  884. Feature request #618 for more flags.
  885. .IP [2] 5
  886. Feature request #1332
  887. .IP [3] 5
  888. Feature request #1337
  889. .IP [4] 5
  890. Cygwin tries to map NTFS ACLs to permissions with varying degrees of success.
  891. .IP [5] 5
  892. The native access control list mechanism of the OS. This normally limits access to
  893. non\-native ACLs. For example, NTFS ACLs aren\(aqt completely accessible on Linux with ntfs\-3g.
  894. .IP [6] 5
  895. extended attributes; key\-value pairs attached to a file, mainly used by the OS.
  896. This includes resource forks on Mac OS X.
  897. .IP [7] 5
  898. aka \fIBSD flags\fP\&. The Linux set of flags [1] is portable across platforms.
  899. The BSDs define additional flags.
  900. .SS SEE ALSO
  901. .sp
  902. \fIborg\-common(1)\fP for common command line options
  903. .sp
  904. \fIborg\-init(1)\fP,
  905. \fIborg\-create(1)\fP, \fIborg\-mount(1)\fP, \fIborg\-extract(1)\fP,
  906. \fIborg\-list(1)\fP, \fIborg\-info(1)\fP,
  907. \fIborg\-delete(1)\fP, \fIborg\-prune(1)\fP,
  908. \fIborg\-recreate(1)\fP
  909. .sp
  910. \fIborg\-compression(1)\fP, \fIborg\-patterns(1)\fP, \fIborg\-placeholders(1)\fP
  911. .INDENT 0.0
  912. .IP \(bu 2
  913. Main web site \fI\%https://www.borgbackup.org/\fP
  914. .IP \(bu 2
  915. Releases \fI\%https://github.com/borgbackup/borg/releases\fP
  916. .IP \(bu 2
  917. Changelog \fI\%https://github.com/borgbackup/borg/blob/master/docs/changes.rst\fP
  918. .IP \(bu 2
  919. GitHub \fI\%https://github.com/borgbackup/borg\fP
  920. .IP \(bu 2
  921. Security contact \fI\%https://borgbackup.readthedocs.io/en/latest/support.html#security\-contact\fP
  922. .UNINDENT
  923. orphan:
  924. .\" Generated by docutils manpage writer.
  925. .