borg-repo-create.1 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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-REPO-CREATE" 1 "2024-11-16" "" "borg backup tool"
  31. .SH NAME
  32. borg-repo-create \- Create a new, empty repository
  33. .SH SYNOPSIS
  34. .sp
  35. borg [common options] repo\-create [options]
  36. .SH DESCRIPTION
  37. .sp
  38. This command creates a new, empty repository. A repository is a \fBborgstore\fP store
  39. containing the deduplicated data from zero or more archives.
  40. .sp
  41. Repository creation can be quite slow for some kinds of stores (e.g. for \fBsftp:\fP) \-
  42. this is due to borgstore pre\-creating all directories needed, making usage of the
  43. store faster.
  44. .SS Encryption mode TLDR
  45. .sp
  46. The encryption mode can only be configured when creating a new repository \- you can
  47. neither configure it on a per\-archive basis nor change the mode of an existing repository.
  48. This example will likely NOT give optimum performance on your machine (performance
  49. tips will come below):
  50. .INDENT 0.0
  51. .INDENT 3.5
  52. .sp
  53. .nf
  54. .ft C
  55. borg repo\-create \-\-encryption repokey\-aes\-ocb
  56. .ft P
  57. .fi
  58. .UNINDENT
  59. .UNINDENT
  60. .sp
  61. Borg will:
  62. .INDENT 0.0
  63. .IP 1. 3
  64. Ask you to come up with a passphrase.
  65. .IP 2. 3
  66. Create a borg key (which contains some random secrets. See \fIkey_files\fP).
  67. .IP 3. 3
  68. Derive a \(dqkey encryption key\(dq from your passphrase
  69. .IP 4. 3
  70. Encrypt and sign the key with the key encryption key
  71. .IP 5. 3
  72. Store the encrypted borg key inside the repository directory (in the repo config).
  73. This is why it is essential to use a secure passphrase.
  74. .IP 6. 3
  75. Encrypt and sign your backups to prevent anyone from reading or forging them unless they
  76. have the key and know the passphrase. Make sure to keep a backup of
  77. your key \fBoutside\fP the repository \- do not lock yourself out by
  78. \(dqleaving your keys inside your car\(dq (see \fIborg_key_export\fP).
  79. The encryption is done locally \- if you use a remote repository, the remote machine
  80. never sees your passphrase, your unencrypted key or your unencrypted files.
  81. Chunking and id generation are also based on your key to improve
  82. your privacy.
  83. .IP 7. 3
  84. Use the key when extracting files to decrypt them and to verify that the contents of
  85. the backups have not been accidentally or maliciously altered.
  86. .UNINDENT
  87. .SS Picking a passphrase
  88. .sp
  89. Make sure you use a good passphrase. Not too short, not too simple. The real
  90. encryption / decryption key is encrypted with / locked by your passphrase.
  91. If an attacker gets your key, he can\(aqt unlock and use it without knowing the
  92. passphrase.
  93. .sp
  94. Be careful with special or non\-ascii characters in your passphrase:
  95. .INDENT 0.0
  96. .IP \(bu 2
  97. Borg processes the passphrase as unicode (and encodes it as utf\-8),
  98. so it does not have problems dealing with even the strangest characters.
  99. .IP \(bu 2
  100. BUT: that does not necessarily apply to your OS / VM / keyboard configuration.
  101. .UNINDENT
  102. .sp
  103. So better use a long passphrase made from simple ascii chars than one that
  104. includes non\-ascii stuff or characters that are hard/impossible to enter on
  105. a different keyboard layout.
  106. .sp
  107. You can change your passphrase for existing repos at any time, it won\(aqt affect
  108. the encryption/decryption key or other secrets.
  109. .SS Choosing an encryption mode
  110. .sp
  111. Depending on your hardware, hashing and crypto performance may vary widely.
  112. The easiest way to find out about what\(aqs fastest is to run \fBborg benchmark cpu\fP\&.
  113. .sp
  114. \fIrepokey\fP modes: if you want ease\-of\-use and \(dqpassphrase\(dq security is good enough \-
  115. the key will be stored in the repository (in \fBrepo_dir/config\fP).
  116. .sp
  117. \fIkeyfile\fP modes: if you want \(dqpassphrase and having\-the\-key\(dq security \-
  118. the key will be stored in your home directory (in \fB~/.config/borg/keys\fP).
  119. .sp
  120. The following table is roughly sorted in order of preference, the better ones are
  121. in the upper part of the table, in the lower part is the old and/or unsafe(r) stuff:
  122. .\" nanorst: inline-fill
  123. .
  124. .TS
  125. center;
  126. |l|l|l|l|.
  127. _
  128. T{
  129. Mode (K = keyfile or repokey)
  130. T} T{
  131. ID\-Hash
  132. T} T{
  133. Encryption
  134. T} T{
  135. Authentication
  136. T}
  137. _
  138. T{
  139. K\-blake2\-chacha20\-poly1305
  140. T} T{
  141. BLAKE2b
  142. T} T{
  143. CHACHA20
  144. T} T{
  145. POLY1305
  146. T}
  147. _
  148. T{
  149. K\-chacha20\-poly1305
  150. T} T{
  151. HMAC\-SHA\-256
  152. T} T{
  153. CHACHA20
  154. T} T{
  155. POLY1305
  156. T}
  157. _
  158. T{
  159. K\-blake2\-aes\-ocb
  160. T} T{
  161. BLAKE2b
  162. T} T{
  163. AES256\-OCB
  164. T} T{
  165. AES256\-OCB
  166. T}
  167. _
  168. T{
  169. K\-aes\-ocb
  170. T} T{
  171. HMAC\-SHA\-256
  172. T} T{
  173. AES256\-OCB
  174. T} T{
  175. AES256\-OCB
  176. T}
  177. _
  178. T{
  179. authenticated\-blake2
  180. T} T{
  181. BLAKE2b
  182. T} T{
  183. none
  184. T} T{
  185. BLAKE2b
  186. T}
  187. _
  188. T{
  189. authenticated
  190. T} T{
  191. HMAC\-SHA\-256
  192. T} T{
  193. none
  194. T} T{
  195. HMAC\-SHA256
  196. T}
  197. _
  198. T{
  199. none
  200. T} T{
  201. SHA\-256
  202. T} T{
  203. none
  204. T} T{
  205. none
  206. T}
  207. _
  208. .TE
  209. .\" nanorst: inline-replace
  210. .
  211. .sp
  212. \fInone\fP mode uses no encryption and no authentication. You\(aqre advised NOT to use this mode
  213. as it would expose you to all sorts of issues (DoS, confidentiality, tampering, ...) in
  214. case of malicious activity in the repository.
  215. .sp
  216. If you do \fBnot\fP want to encrypt the contents of your backups, but still want to detect
  217. malicious tampering use an \fIauthenticated\fP mode. It\(aqs like \fIrepokey\fP minus encryption.
  218. To normally work with \fBauthenticated\fP repos, you will need the passphrase, but
  219. there is an emergency workaround, see \fBBORG_WORKAROUNDS=authenticated_no_key\fP docs.
  220. .SS Creating a related repository
  221. .sp
  222. You can use \fBborg repo\-create \-\-other\-repo ORIG_REPO ...\fP to create a related repository
  223. that uses the same secret key material as the given other/original repository.
  224. .sp
  225. By default, only the ID key and chunker secret will be the same (these are important
  226. for deduplication) and the AE crypto keys will be newly generated random keys.
  227. .sp
  228. Optionally, if you use \fB\-\-copy\-crypt\-key\fP you can also keep the same crypt_key
  229. (used for authenticated encryption). Might be desired e.g. if you want to have less
  230. keys to manage.
  231. .sp
  232. Creating related repositories is useful e.g. if you want to use \fBborg transfer\fP later.
  233. .SS Creating a related repository for data migration from borg 1.2 or 1.4
  234. .sp
  235. You can use \fBborg repo\-create \-\-other\-repo ORIG_REPO \-\-from\-borg1 ...\fP to create a related
  236. repository that uses the same secret key material as the given other/original repository.
  237. .sp
  238. Then use \fBborg transfer \-\-other\-repo ORIG_REPO \-\-from\-borg1 ...\fP to transfer the archives.
  239. .SH OPTIONS
  240. .sp
  241. See \fIborg\-common(1)\fP for common options of Borg commands.
  242. .SS optional arguments
  243. .INDENT 0.0
  244. .TP
  245. .BI \-\-other\-repo \ SRC_REPOSITORY
  246. reuse the key material from the other repository
  247. .TP
  248. .B \-\-from\-borg1
  249. other repository is borg 1.x
  250. .TP
  251. .BI \-e \ MODE\fR,\fB \ \-\-encryption \ MODE
  252. select encryption key mode \fB(required)\fP
  253. .TP
  254. .B \-\-append\-only
  255. 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.
  256. .TP
  257. .BI \-\-storage\-quota \ QUOTA
  258. Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota.
  259. .TP
  260. .B \-\-make\-parent\-dirs
  261. create the parent directories of the repository directory, if they are missing.
  262. .TP
  263. .B \-\-copy\-crypt\-key
  264. copy the crypt_key (used for authenticated encryption) from the key of the other repo (default: new random key).
  265. .UNINDENT
  266. .SH EXAMPLES
  267. .INDENT 0.0
  268. .INDENT 3.5
  269. .sp
  270. .nf
  271. .ft C
  272. # Local repository
  273. $ export BORG_REPO=/path/to/repo
  274. # recommended repokey AEAD crypto modes
  275. $ borg repo\-create \-\-encryption=repokey\-aes\-ocb
  276. $ borg repo\-create \-\-encryption=repokey\-chacha20\-poly1305
  277. $ borg repo\-create \-\-encryption=repokey\-blake2\-aes\-ocb
  278. $ borg repo\-create \-\-encryption=repokey\-blake2\-chacha20\-poly1305
  279. # no encryption, not recommended
  280. $ borg repo\-create \-\-encryption=authenticated
  281. $ borg repo\-create \-\-encryption=authenticated\-blake2
  282. $ borg repo\-create \-\-encryption=none
  283. # Remote repository (accesses a remote borg via ssh)
  284. $ export BORG_REPO=ssh://user@hostname/~/backup
  285. # repokey: stores the (encrypted) key into <REPO_DIR>/config
  286. $ borg repo\-create \-\-encryption=repokey\-aes\-ocb
  287. # keyfile: stores the (encrypted) key into ~/.config/borg/keys/
  288. $ borg repo\-create \-\-encryption=keyfile\-aes\-ocb
  289. .ft P
  290. .fi
  291. .UNINDENT
  292. .UNINDENT
  293. .SH SEE ALSO
  294. .sp
  295. \fIborg\-common(1)\fP, \fIborg\-repo\-delete(1)\fP, \fIborg\-repo\-list(1)\fP, \fIborg\-check(1)\fP, \fIborg\-benchmark\-cpu(1)\fP, \fIborg\-key\-import(1)\fP, \fIborg\-key\-export(1)\fP, \fIborg\-key\-change\-passphrase(1)\fP
  296. .SH AUTHOR
  297. The Borg Collective
  298. .\" Generated by docutils manpage writer.
  299. .