borg-init.1 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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-INIT" 1 "2022-02-19" "" "borg backup tool"
  31. .SH NAME
  32. borg-init \- Initialize an empty repository
  33. .SH SYNOPSIS
  34. .sp
  35. borg [common options] init [options] [REPOSITORY]
  36. .SH DESCRIPTION
  37. .sp
  38. This command initializes an empty repository. A repository is a filesystem
  39. directory containing the deduplicated data from zero or more archives.
  40. .SS Encryption mode TLDR
  41. .sp
  42. The encryption mode can only be configured when creating a new repository \-
  43. you can neither configure it on a per\-archive basis nor change the
  44. encryption mode of an existing repository.
  45. .sp
  46. Use \fBrepokey\fP:
  47. .INDENT 0.0
  48. .INDENT 3.5
  49. .sp
  50. .nf
  51. .ft C
  52. borg init \-\-encryption repokey /path/to/repo
  53. .ft P
  54. .fi
  55. .UNINDENT
  56. .UNINDENT
  57. .sp
  58. Or \fBrepokey\-blake2\fP depending on which is faster on your client machines (see below):
  59. .INDENT 0.0
  60. .INDENT 3.5
  61. .sp
  62. .nf
  63. .ft C
  64. borg init \-\-encryption repokey\-blake2 /path/to/repo
  65. .ft P
  66. .fi
  67. .UNINDENT
  68. .UNINDENT
  69. .sp
  70. Borg will:
  71. .INDENT 0.0
  72. .IP 1. 3
  73. Ask you to come up with a passphrase.
  74. .IP 2. 3
  75. Create a borg key (which contains 3 random secrets. See \fIkey_files\fP).
  76. .IP 3. 3
  77. Encrypt the key with your passphrase.
  78. .IP 4. 3
  79. Store the encrypted borg key inside the repository directory (in the repo config).
  80. This is why it is essential to use a secure passphrase.
  81. .IP 5. 3
  82. Encrypt and sign your backups to prevent anyone from reading or forging them unless they
  83. have the key and know the passphrase. Make sure to keep a backup of
  84. your key \fBoutside\fP the repository \- do not lock yourself out by
  85. "leaving your keys inside your car" (see \fIborg_key_export\fP).
  86. For remote backups the encryption is done locally \- the remote machine
  87. never sees your passphrase, your unencrypted key or your unencrypted files.
  88. Chunking and id generation are also based on your key to improve
  89. your privacy.
  90. .IP 6. 3
  91. Use the key when extracting files to decrypt them and to verify that the contents of
  92. the backups have not been accidentally or maliciously altered.
  93. .UNINDENT
  94. .SS Picking a passphrase
  95. .sp
  96. Make sure you use a good passphrase. Not too short, not too simple. The real
  97. encryption / decryption key is encrypted with / locked by your passphrase.
  98. If an attacker gets your key, he can\(aqt unlock and use it without knowing the
  99. passphrase.
  100. .sp
  101. Be careful with special or non\-ascii characters in your passphrase:
  102. .INDENT 0.0
  103. .IP \(bu 2
  104. Borg processes the passphrase as unicode (and encodes it as utf\-8),
  105. so it does not have problems dealing with even the strangest characters.
  106. .IP \(bu 2
  107. BUT: that does not necessarily apply to your OS / VM / keyboard configuration.
  108. .UNINDENT
  109. .sp
  110. So better use a long passphrase made from simple ascii chars than one that
  111. includes non\-ascii stuff or characters that are hard/impossible to enter on
  112. a different keyboard layout.
  113. .sp
  114. You can change your passphrase for existing repos at any time, it won\(aqt affect
  115. the encryption/decryption key or other secrets.
  116. .SS More encryption modes
  117. .sp
  118. Only use \fB\-\-encryption none\fP if you are OK with anyone who has access to
  119. your repository being able to read your backups and tamper with their
  120. contents without you noticing.
  121. .sp
  122. If you want "passphrase and having\-the\-key" security, use \fB\-\-encryption keyfile\fP\&.
  123. The key will be stored in your home directory (in \fB~/.config/borg/keys\fP).
  124. .sp
  125. If you do \fBnot\fP want to encrypt the contents of your backups, but still
  126. want to detect malicious tampering use \fB\-\-encryption authenticated\fP\&.
  127. .sp
  128. If \fBBLAKE2b\fP is faster than \fBSHA\-256\fP on your hardware, use \fB\-\-encryption authenticated\-blake2\fP,
  129. \fB\-\-encryption repokey\-blake2\fP or \fB\-\-encryption keyfile\-blake2\fP\&. Note: for remote backups
  130. the hashing is done on your local machine.
  131. .\" nanorst: inline-fill
  132. .
  133. .TS
  134. center;
  135. |l|l|l|l|.
  136. _
  137. T{
  138. Hash/MAC
  139. T} T{
  140. Not encrypted
  141. no auth
  142. T} T{
  143. Not encrypted,
  144. but authenticated
  145. T} T{
  146. Encrypted (AEAD w/ AES)
  147. and authenticated
  148. T}
  149. _
  150. T{
  151. SHA\-256
  152. T} T{
  153. none
  154. T} T{
  155. \fIauthenticated\fP
  156. T} T{
  157. repokey
  158. keyfile
  159. T}
  160. _
  161. T{
  162. BLAKE2b
  163. T} T{
  164. n/a
  165. T} T{
  166. \fIauthenticated\-blake2\fP
  167. T} T{
  168. \fIrepokey\-blake2\fP
  169. \fIkeyfile\-blake2\fP
  170. T}
  171. _
  172. .TE
  173. .\" nanorst: inline-replace
  174. .
  175. .sp
  176. Modes \fImarked like this\fP in the above table are new in Borg 1.1 and are not
  177. backwards\-compatible with Borg 1.0.x.
  178. .sp
  179. On modern Intel/AMD CPUs (except very cheap ones), AES is usually
  180. hardware\-accelerated.
  181. BLAKE2b is faster than SHA256 on Intel/AMD 64\-bit CPUs
  182. (except AMD Ryzen and future CPUs with SHA extensions),
  183. which makes \fIauthenticated\-blake2\fP faster than \fInone\fP and \fIauthenticated\fP\&.
  184. .sp
  185. On modern ARM CPUs, NEON provides hardware acceleration for SHA256 making it faster
  186. than BLAKE2b\-256 there. NEON accelerates AES as well.
  187. .sp
  188. Hardware acceleration is always used automatically when available.
  189. .sp
  190. \fIrepokey\fP and \fIkeyfile\fP use AES\-CTR\-256 for encryption and HMAC\-SHA256 for
  191. authentication in an encrypt\-then\-MAC (EtM) construction. The chunk ID hash
  192. is HMAC\-SHA256 as well (with a separate key).
  193. These modes are compatible with Borg 1.0.x.
  194. .sp
  195. \fIrepokey\-blake2\fP and \fIkeyfile\-blake2\fP are also authenticated encryption modes,
  196. but use BLAKE2b\-256 instead of HMAC\-SHA256 for authentication. The chunk ID
  197. hash is a keyed BLAKE2b\-256 hash.
  198. These modes are new and \fInot\fP compatible with Borg 1.0.x.
  199. .sp
  200. \fIauthenticated\fP mode uses no encryption, but authenticates repository contents
  201. through the same HMAC\-SHA256 hash as the \fIrepokey\fP and \fIkeyfile\fP modes (it uses it
  202. as the chunk ID hash). The key is stored like \fIrepokey\fP\&.
  203. This mode is new and \fInot\fP compatible with Borg 1.0.x.
  204. .sp
  205. \fIauthenticated\-blake2\fP is like \fIauthenticated\fP, but uses the keyed BLAKE2b\-256 hash
  206. from the other blake2 modes.
  207. This mode is new and \fInot\fP compatible with Borg 1.0.x.
  208. .sp
  209. \fInone\fP mode uses no encryption and no authentication. It uses SHA256 as chunk
  210. ID hash. This mode is not recommended, you should rather consider using an authenticated
  211. or authenticated/encrypted mode. This mode has possible denial\-of\-service issues
  212. when running \fBborg create\fP on contents controlled by an attacker.
  213. Use it only for new repositories where no encryption is wanted \fBand\fP when compatibility
  214. with 1.0.x is important. If compatibility with 1.0.x is not important, use
  215. \fIauthenticated\-blake2\fP or \fIauthenticated\fP instead.
  216. This mode is compatible with Borg 1.0.x.
  217. .SH OPTIONS
  218. .sp
  219. See \fIborg\-common(1)\fP for common options of Borg commands.
  220. .SS arguments
  221. .INDENT 0.0
  222. .TP
  223. .B REPOSITORY
  224. repository to create
  225. .UNINDENT
  226. .SS optional arguments
  227. .INDENT 0.0
  228. .TP
  229. .BI \-e \ MODE\fR,\fB \ \-\-encryption \ MODE
  230. select encryption key mode \fB(required)\fP
  231. .TP
  232. .B \-\-append\-only
  233. create an append\-only mode repository. Note that this only affects the low level structure of the repository, and running \fIdelete\fP or \fIprune\fP will still be allowed. See \fIappend_only_mode\fP in Additional Notes for more details.
  234. .TP
  235. .BI \-\-storage\-quota \ QUOTA
  236. Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota.
  237. .TP
  238. .B \-\-make\-parent\-dirs
  239. create the parent directories of the repository directory, if they are missing.
  240. .UNINDENT
  241. .SH EXAMPLES
  242. .INDENT 0.0
  243. .INDENT 3.5
  244. .sp
  245. .nf
  246. .ft C
  247. # Local repository, repokey encryption, BLAKE2b (often faster, since Borg 1.1)
  248. $ borg init \-\-encryption=repokey\-blake2 /path/to/repo
  249. # Local repository (no encryption)
  250. $ borg init \-\-encryption=none /path/to/repo
  251. # Remote repository (accesses a remote borg via ssh)
  252. # repokey: stores the (encrypted) key into <REPO_DIR>/config
  253. $ borg init \-\-encryption=repokey\-blake2 user@hostname:backup
  254. # Remote repository (accesses a remote borg via ssh)
  255. # keyfile: stores the (encrypted) key into ~/.config/borg/keys/
  256. $ borg init \-\-encryption=keyfile user@hostname:backup
  257. .ft P
  258. .fi
  259. .UNINDENT
  260. .UNINDENT
  261. .SH SEE ALSO
  262. .sp
  263. \fIborg\-common(1)\fP, \fIborg\-create(1)\fP, \fIborg\-delete(1)\fP, \fIborg\-check(1)\fP, \fIborg\-list(1)\fP, \fIborg\-key\-import(1)\fP, \fIborg\-key\-export(1)\fP, \fIborg\-key\-change\-passphrase(1)\fP
  264. .SH AUTHOR
  265. The Borg Collective
  266. .\" Generated by docutils manpage writer.
  267. .