repo-create.rst.inc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_repo-create:
  3. borg repo-create
  4. ----------------
  5. .. code-block:: none
  6. borg [common options] repo-create [options]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  10. | **optional arguments** |
  11. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  12. | | ``--other-repo SRC_REPOSITORY`` | reuse the key material from the other repository |
  13. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | | ``--from-borg1`` | other repository is borg 1.x |
  15. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | | ``-e MODE``, ``--encryption MODE`` | select encryption key mode **(required)** |
  17. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | | ``--append-only`` | create an append-only mode repository. Note that this only affects the low level structure of the repository, and running `delete` or `prune` will still be allowed. See :ref:`append_only_mode` in Additional Notes for more details. |
  19. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | | ``--storage-quota QUOTA`` | Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota. |
  21. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | | ``--make-parent-dirs`` | create the parent directories of the repository directory, if they are missing. |
  23. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | | ``--copy-crypt-key`` | copy the crypt_key (used for authenticated encryption) from the key of the other repo (default: new random key). |
  25. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | .. class:: borg-common-opt-ref |
  27. | |
  28. | :ref:`common_options` |
  29. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. .. raw:: html
  31. <script type='text/javascript'>
  32. $(document).ready(function () {
  33. $('.borg-options-table colgroup').remove();
  34. })
  35. </script>
  36. .. only:: latex
  37. optional arguments
  38. --other-repo SRC_REPOSITORY reuse the key material from the other repository
  39. --from-borg1 other repository is borg 1.x
  40. -e MODE, --encryption MODE select encryption key mode **(required)**
  41. --append-only create an append-only mode repository. Note that this only affects the low level structure of the repository, and running `delete` or `prune` will still be allowed. See :ref:`append_only_mode` in Additional Notes for more details.
  42. --storage-quota QUOTA Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota.
  43. --make-parent-dirs create the parent directories of the repository directory, if they are missing.
  44. --copy-crypt-key copy the crypt_key (used for authenticated encryption) from the key of the other repo (default: new random key).
  45. :ref:`common_options`
  46. |
  47. Description
  48. ~~~~~~~~~~~
  49. This command creates a new, empty repository. A repository is a ``borgstore`` store
  50. containing the deduplicated data from zero or more archives.
  51. Repository creation can be quite slow for some kinds of stores (e.g. for ``sftp:``) -
  52. this is due to borgstore pre-creating all directories needed, making usage of the
  53. store faster.
  54. Encryption mode TLDR
  55. ++++++++++++++++++++
  56. The encryption mode can only be configured when creating a new repository - you can
  57. neither configure it on a per-archive basis nor change the mode of an existing repository.
  58. This example will likely NOT give optimum performance on your machine (performance
  59. tips will come below):
  60. ::
  61. borg repo-create --encryption repokey-aes-ocb
  62. Borg will:
  63. 1. Ask you to come up with a passphrase.
  64. 2. Create a borg key (which contains some random secrets. See :ref:`key_files`).
  65. 3. Derive a "key encryption key" from your passphrase
  66. 4. Encrypt and sign the key with the key encryption key
  67. 5. Store the encrypted borg key inside the repository directory (in the repo config).
  68. This is why it is essential to use a secure passphrase.
  69. 6. Encrypt and sign your backups to prevent anyone from reading or forging them unless they
  70. have the key and know the passphrase. Make sure to keep a backup of
  71. your key **outside** the repository - do not lock yourself out by
  72. "leaving your keys inside your car" (see :ref:`borg_key_export`).
  73. The encryption is done locally - if you use a remote repository, the remote machine
  74. never sees your passphrase, your unencrypted key or your unencrypted files.
  75. Chunking and id generation are also based on your key to improve
  76. your privacy.
  77. 7. Use the key when extracting files to decrypt them and to verify that the contents of
  78. the backups have not been accidentally or maliciously altered.
  79. Picking a passphrase
  80. ++++++++++++++++++++
  81. Make sure you use a good passphrase. Not too short, not too simple. The real
  82. encryption / decryption key is encrypted with / locked by your passphrase.
  83. If an attacker gets your key, he can't unlock and use it without knowing the
  84. passphrase.
  85. Be careful with special or non-ascii characters in your passphrase:
  86. - Borg processes the passphrase as unicode (and encodes it as utf-8),
  87. so it does not have problems dealing with even the strangest characters.
  88. - BUT: that does not necessarily apply to your OS / VM / keyboard configuration.
  89. So better use a long passphrase made from simple ascii chars than one that
  90. includes non-ascii stuff or characters that are hard/impossible to enter on
  91. a different keyboard layout.
  92. You can change your passphrase for existing repos at any time, it won't affect
  93. the encryption/decryption key or other secrets.
  94. Choosing an encryption mode
  95. +++++++++++++++++++++++++++
  96. Depending on your hardware, hashing and crypto performance may vary widely.
  97. The easiest way to find out about what's fastest is to run ``borg benchmark cpu``.
  98. `repokey` modes: if you want ease-of-use and "passphrase" security is good enough -
  99. the key will be stored in the repository (in ``repo_dir/config``).
  100. `keyfile` modes: if you want "passphrase and having-the-key" security -
  101. the key will be stored in your home directory (in ``~/.config/borg/keys``).
  102. The following table is roughly sorted in order of preference, the better ones are
  103. in the upper part of the table, in the lower part is the old and/or unsafe(r) stuff:
  104. .. nanorst: inline-fill
  105. +-----------------------------------+--------------+----------------+--------------------+
  106. | Mode (K = keyfile or repokey) | ID-Hash | Encryption | Authentication |
  107. +-----------------------------------+--------------+----------------+--------------------+
  108. | K-blake2-chacha20-poly1305 | BLAKE2b | CHACHA20 | POLY1305 |
  109. +-----------------------------------+--------------+----------------+--------------------+
  110. | K-chacha20-poly1305 | HMAC-SHA-256 | CHACHA20 | POLY1305 |
  111. +-----------------------------------+--------------+----------------+--------------------+
  112. | K-blake2-aes-ocb | BLAKE2b | AES256-OCB | AES256-OCB |
  113. +-----------------------------------+--------------+----------------+--------------------+
  114. | K-aes-ocb | HMAC-SHA-256 | AES256-OCB | AES256-OCB |
  115. +-----------------------------------+--------------+----------------+--------------------+
  116. | authenticated-blake2 | BLAKE2b | none | BLAKE2b |
  117. +-----------------------------------+--------------+----------------+--------------------+
  118. | authenticated | HMAC-SHA-256 | none | HMAC-SHA256 |
  119. +-----------------------------------+--------------+----------------+--------------------+
  120. | none | SHA-256 | none | none |
  121. +-----------------------------------+--------------+----------------+--------------------+
  122. .. nanorst: inline-replace
  123. `none` mode uses no encryption and no authentication. You're advised NOT to use this mode
  124. as it would expose you to all sorts of issues (DoS, confidentiality, tampering, ...) in
  125. case of malicious activity in the repository.
  126. If you do **not** want to encrypt the contents of your backups, but still want to detect
  127. malicious tampering use an `authenticated` mode. It's like `repokey` minus encryption.
  128. To normally work with ``authenticated`` repos, you will need the passphrase, but
  129. there is an emergency workaround, see ``BORG_WORKAROUNDS=authenticated_no_key`` docs.
  130. Creating a related repository
  131. +++++++++++++++++++++++++++++
  132. You can use ``borg repo-create --other-repo ORIG_REPO ...`` to create a related repository
  133. that uses the same secret key material as the given other/original repository.
  134. By default, only the ID key and chunker secret will be the same (these are important
  135. for deduplication) and the AE crypto keys will be newly generated random keys.
  136. Optionally, if you use ``--copy-crypt-key`` you can also keep the same crypt_key
  137. (used for authenticated encryption). Might be desired e.g. if you want to have less
  138. keys to manage.
  139. Creating related repositories is useful e.g. if you want to use ``borg transfer`` later.
  140. Creating a related repository for data migration from borg 1.2 or 1.4
  141. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  142. You can use ``borg repo-create --other-repo ORIG_REPO --from-borg1 ...`` to create a related
  143. repository that uses the same secret key material as the given other/original repository.
  144. Then use ``borg transfer --other-repo ORIG_REPO --from-borg1 ...`` to transfer the archives.