borg-init.1 8.7 KB

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