borg-repo-create.1 8.7 KB

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