2
0

init.rst.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_init:
  3. borg init
  4. ---------
  5. .. code-block:: none
  6. borg [common options] init [options] [REPOSITORY]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  10. | **positional arguments** |
  11. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  12. | | ``REPOSITORY`` | repository to create |
  13. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | **options** |
  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. | .. class:: borg-common-opt-ref |
  25. | |
  26. | :ref:`common_options` |
  27. +-------------------------------------------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. .. raw:: html
  29. <script type='text/javascript'>
  30. $(document).ready(function () {
  31. $('.borg-options-table colgroup').remove();
  32. })
  33. </script>
  34. .. only:: latex
  35. REPOSITORY
  36. repository to create
  37. options
  38. -e MODE, --encryption MODE select encryption key mode **(required)**
  39. --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.
  40. --storage-quota QUOTA Set storage quota of the new repository (e.g. 5G, 1.5T). Default: no quota.
  41. --make-parent-dirs create the parent directories of the repository directory, if they are missing.
  42. :ref:`common_options`
  43. |
  44. Description
  45. ~~~~~~~~~~~
  46. This command initializes an empty repository. A repository is a filesystem
  47. directory containing the deduplicated data from zero or more archives.
  48. Encryption mode TLDR
  49. ++++++++++++++++++++
  50. The encryption mode can only be configured when creating a new repository -
  51. you can neither configure it on a per-archive basis nor change the
  52. encryption mode of an existing repository.
  53. Use ``repokey``::
  54. borg init --encryption repokey /path/to/repo
  55. Or ``repokey-blake2`` depending on which is faster on your client machines (see below)::
  56. borg init --encryption repokey-blake2 /path/to/repo
  57. Borg will:
  58. 1. Ask you to come up with a passphrase.
  59. 2. Create a borg key (which contains 3 random secrets. See :ref:`key_files`).
  60. 3. Encrypt the key with your passphrase.
  61. 4. Store the encrypted borg key inside the repository directory (in the repo config).
  62. This is why it is essential to use a secure passphrase.
  63. 5. Encrypt and sign your backups to prevent anyone from reading or forging them unless they
  64. have the key and know the passphrase. Make sure to keep a backup of
  65. your key **outside** the repository - do not lock yourself out by
  66. "leaving your keys inside your car" (see :ref:`borg_key_export`).
  67. For remote backups the encryption is done locally - the remote machine
  68. never sees your passphrase, your unencrypted key or your unencrypted files.
  69. Chunking and id generation are also based on your key to improve
  70. your privacy.
  71. 6. Use the key when extracting files to decrypt them and to verify that the contents of
  72. the backups have not been accidentally or maliciously altered.
  73. Picking a passphrase
  74. ++++++++++++++++++++
  75. Make sure you use a good passphrase. Not too short, not too simple. The real
  76. encryption / decryption key is encrypted with / locked by your passphrase.
  77. If an attacker gets your key, he can't unlock and use it without knowing the
  78. passphrase.
  79. Be careful with special or non-ascii characters in your passphrase:
  80. - Borg processes the passphrase as unicode (and encodes it as utf-8),
  81. so it does not have problems dealing with even the strangest characters.
  82. - BUT: that does not necessarily apply to your OS / VM / keyboard configuration.
  83. So better use a long passphrase made from simple ascii chars than one that
  84. includes non-ascii stuff or characters that are hard/impossible to enter on
  85. a different keyboard layout.
  86. You can change your passphrase for existing repos at any time, it won't affect
  87. the encryption/decryption key or other secrets.
  88. More encryption modes
  89. +++++++++++++++++++++
  90. Only use ``--encryption none`` if you are OK with anyone who has access to
  91. your repository being able to read your backups and tamper with their
  92. contents without you noticing.
  93. If you want "passphrase and having-the-key" security, use ``--encryption keyfile``.
  94. The key will be stored in your home directory (in ``~/.config/borg/keys``).
  95. If you do **not** want to encrypt the contents of your backups, but still
  96. want to detect malicious tampering use ``--encryption authenticated``.
  97. To normally work with ``authenticated`` repos, you will need the passphrase, but
  98. there is an emergency workaround, see ``BORG_WORKAROUNDS=authenticated_no_key`` docs.
  99. If ``BLAKE2b`` is faster than ``SHA-256`` on your hardware, use ``--encryption authenticated-blake2``,
  100. ``--encryption repokey-blake2`` or ``--encryption keyfile-blake2``. Note: for remote backups
  101. the hashing is done on your local machine.
  102. .. nanorst: inline-fill
  103. +----------+---------------+------------------------+--------------------------+
  104. | Hash/MAC | Not encrypted | Not encrypted, | Encrypted (AEAD w/ AES) |
  105. | | no auth | but authenticated | and authenticated |
  106. +----------+---------------+------------------------+--------------------------+
  107. | SHA-256 | none | `authenticated` | repokey |
  108. | | | | keyfile |
  109. +----------+---------------+------------------------+--------------------------+
  110. | BLAKE2b | n/a | `authenticated-blake2` | `repokey-blake2` |
  111. | | | | `keyfile-blake2` |
  112. +----------+---------------+------------------------+--------------------------+
  113. .. nanorst: inline-replace
  114. Modes `marked like this` in the above table are new in Borg 1.1 and are not
  115. backwards-compatible with Borg 1.0.x.
  116. On modern Intel/AMD CPUs (except very cheap ones), AES is usually
  117. hardware-accelerated.
  118. BLAKE2b is faster than SHA256 on Intel/AMD 64-bit CPUs
  119. (except AMD Ryzen and future CPUs with SHA extensions),
  120. which makes `authenticated-blake2` faster than `none` and `authenticated`.
  121. On modern ARM CPUs, NEON provides hardware acceleration for SHA256 making it faster
  122. than BLAKE2b-256 there. NEON accelerates AES as well.
  123. Hardware acceleration is always used automatically when available.
  124. `repokey` and `keyfile` use AES-CTR-256 for encryption and HMAC-SHA256 for
  125. authentication in an encrypt-then-MAC (EtM) construction. The chunk ID hash
  126. is HMAC-SHA256 as well (with a separate key).
  127. These modes are compatible with Borg 1.0.x.
  128. `repokey-blake2` and `keyfile-blake2` are also authenticated encryption modes,
  129. but use BLAKE2b-256 instead of HMAC-SHA256 for authentication. The chunk ID
  130. hash is a keyed BLAKE2b-256 hash.
  131. These modes are new and *not* compatible with Borg 1.0.x.
  132. `authenticated` mode uses no encryption, but authenticates repository contents
  133. through the same HMAC-SHA256 hash as the `repokey` and `keyfile` modes (it uses it
  134. as the chunk ID hash). The key is stored like `repokey`.
  135. This mode is new and *not* compatible with Borg 1.0.x.
  136. `authenticated-blake2` is like `authenticated`, but uses the keyed BLAKE2b-256 hash
  137. from the other blake2 modes.
  138. This mode is new and *not* compatible with Borg 1.0.x.
  139. `none` mode uses no encryption and no authentication. It uses SHA256 as chunk
  140. ID hash. This mode is not recommended, you should rather consider using an authenticated
  141. or authenticated/encrypted mode. This mode has possible denial-of-service issues
  142. when running ``borg create`` on contents controlled by an attacker.
  143. Use it only for new repositories where no encryption is wanted **and** when compatibility
  144. with 1.0.x is important. If compatibility with 1.0.x is not important, use
  145. `authenticated-blake2` or `authenticated` instead.
  146. This mode is compatible with Borg 1.0.x.