create.rst.inc 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_create:
  3. borg create
  4. -----------
  5. .. code-block:: none
  6. borg [common options] create [options] ARCHIVE [PATH...]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  10. | **positional arguments** |
  11. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  12. | | ``ARCHIVE`` | name of archive to create (must be also a valid directory name) |
  13. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | | ``PATH`` | paths to archive |
  15. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | **optional arguments** |
  17. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | | ``-n``, ``--dry-run`` | do not create a backup archive |
  19. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | | ``-s``, ``--stats`` | print statistics for the created archive |
  21. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | | ``--list`` | output verbose list of items (files, dirs, ...) |
  23. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | | ``--filter STATUSCHARS`` | only display items with the given status characters (see description) |
  25. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | | ``--json`` | output stats as JSON. Implies ``--stats``. |
  27. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | | ``--no-cache-sync`` | experimental: do not synchronize the cache. Implies not using the files cache. |
  29. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | .. class:: borg-common-opt-ref |
  31. | |
  32. | :ref:`common_options` |
  33. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | **Exclusion options** |
  35. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | | ``-e PATTERN``, ``--exclude PATTERN`` | exclude paths matching PATTERN |
  37. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | | ``--exclude-from EXCLUDEFILE`` | read exclude patterns from EXCLUDEFILE, one per line |
  39. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | | ``--pattern PATTERN`` | experimental: include/exclude paths matching PATTERN |
  41. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | | ``--patterns-from PATTERNFILE`` | experimental: read include/exclude patterns from PATTERNFILE, one per line |
  43. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | | ``--exclude-caches`` | exclude directories that contain a CACHEDIR.TAG file (http://www.brynosaurus.com/cachedir/spec.html) |
  45. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | | ``--exclude-if-present NAME`` | exclude directories that are tagged by containing a filesystem object with the given NAME |
  47. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | | ``--keep-exclude-tags``, ``--keep-tag-files`` | if tag objects are specified with ``--exclude-if-present``, don't omit the tag objects themselves from the backup archive |
  49. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | **Filesystem options** |
  51. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | | ``-x``, ``--one-file-system`` | stay in the same file system and do not store mount points of other file systems |
  53. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | | ``--numeric-owner`` | only store numeric user and group identifiers |
  55. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | | ``--noatime`` | do not store atime into archive |
  57. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | | ``--noctime`` | do not store ctime into archive |
  59. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | | ``--ignore-inode`` | ignore inode data in the file metadata cache used to detect unchanged files. |
  61. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | | ``--files-cache MODE`` | operate files cache in MODE. default: ctime,size,inode |
  63. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | | ``--read-special`` | open and read block and char device files as well as FIFOs as if they were regular files. Also follows symlinks pointing to these kinds of files. |
  65. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | **Archive options** |
  67. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | | ``--comment COMMENT`` | add a comment text to the archive |
  69. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | | ``--timestamp TIMESTAMP`` | manually specify the archive creation date/time (UTC, yyyy-mm-ddThh:mm:ss format). Alternatively, give a reference file/directory. |
  71. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | | ``-c SECONDS``, ``--checkpoint-interval SECONDS`` | write checkpoint every SECONDS seconds (Default: 1800) |
  73. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | | ``--chunker-params PARAMS`` | specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, HASH_MASK_BITS, HASH_WINDOW_SIZE). default: 19,23,21,4095 |
  75. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | | ``-C COMPRESSION``, ``--compression COMPRESSION`` | select compression algorithm, see the output of the "borg help compression" command for details. |
  77. +-------------------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  78. .. raw:: html
  79. <script type='text/javascript'>
  80. $(document).ready(function () {
  81. $('.borg-options-table colgroup').remove();
  82. })
  83. </script>
  84. .. only:: latex
  85. ARCHIVE
  86. name of archive to create (must be also a valid directory name)
  87. PATH
  88. paths to archive
  89. optional arguments
  90. -n, --dry-run do not create a backup archive
  91. -s, --stats print statistics for the created archive
  92. --list output verbose list of items (files, dirs, ...)
  93. --filter STATUSCHARS only display items with the given status characters (see description)
  94. --json output stats as JSON. Implies ``--stats``.
  95. --no-cache-sync experimental: do not synchronize the cache. Implies not using the files cache.
  96. :ref:`common_options`
  97. |
  98. Exclusion options
  99. -e PATTERN, --exclude PATTERN exclude paths matching PATTERN
  100. --exclude-from EXCLUDEFILE read exclude patterns from EXCLUDEFILE, one per line
  101. --pattern PATTERN experimental: include/exclude paths matching PATTERN
  102. --patterns-from PATTERNFILE experimental: read include/exclude patterns from PATTERNFILE, one per line
  103. --exclude-caches exclude directories that contain a CACHEDIR.TAG file (http://www.brynosaurus.com/cachedir/spec.html)
  104. --exclude-if-present NAME exclude directories that are tagged by containing a filesystem object with the given NAME
  105. --keep-exclude-tags, --keep-tag-files if tag objects are specified with ``--exclude-if-present``, don't omit the tag objects themselves from the backup archive
  106. Filesystem options
  107. -x, --one-file-system stay in the same file system and do not store mount points of other file systems
  108. --numeric-owner only store numeric user and group identifiers
  109. --noatime do not store atime into archive
  110. --noctime do not store ctime into archive
  111. --ignore-inode ignore inode data in the file metadata cache used to detect unchanged files.
  112. --files-cache MODE operate files cache in MODE. default: ctime,size,inode
  113. --read-special open and read block and char device files as well as FIFOs as if they were regular files. Also follows symlinks pointing to these kinds of files.
  114. Archive options
  115. --comment COMMENT add a comment text to the archive
  116. --timestamp TIMESTAMP manually specify the archive creation date/time (UTC, yyyy-mm-ddThh:mm:ss format). Alternatively, give a reference file/directory.
  117. -c SECONDS, --checkpoint-interval SECONDS write checkpoint every SECONDS seconds (Default: 1800)
  118. --chunker-params PARAMS specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, HASH_MASK_BITS, HASH_WINDOW_SIZE). default: 19,23,21,4095
  119. -C COMPRESSION, --compression COMPRESSION select compression algorithm, see the output of the "borg help compression" command for details.
  120. Description
  121. ~~~~~~~~~~~
  122. This command creates a backup archive containing all files found while recursively
  123. traversing all paths specified. Paths are added to the archive as they are given,
  124. that means if relative paths are desired, the command has to be run from the correct
  125. directory.
  126. When giving '-' as path, borg will read data from standard input and create a
  127. file 'stdin' in the created archive from that data.
  128. The archive will consume almost no disk space for files or parts of files that
  129. have already been stored in other archives.
  130. The archive name needs to be unique. It must not end in '.checkpoint' or
  131. '.checkpoint.N' (with N being a number), because these names are used for
  132. checkpoints and treated in special ways.
  133. In the archive name, you may use the following placeholders:
  134. {now}, {utcnow}, {fqdn}, {hostname}, {user} and some others.
  135. Backup speed is increased by not reprocessing files that are already part of
  136. existing archives and weren't modified. The detection of unmodified files is
  137. done by comparing multiple file metadata values with previous values kept in
  138. the files cache.
  139. This comparison can operate in different modes as given by ``--files-cache``:
  140. - ctime,size,inode (default)
  141. - mtime,size,inode (default behaviour of borg versions older than 1.1.0rc4)
  142. - ctime,size (ignore the inode number)
  143. - mtime,size (ignore the inode number)
  144. - rechunk,ctime (all files are considered modified - rechunk, cache ctime)
  145. - rechunk,mtime (all files are considered modified - rechunk, cache mtime)
  146. - disabled (disable the files cache, all files considered modified - rechunk)
  147. inode number: better safety, but often unstable on network filesystems
  148. Normally, detecting file modifications will take inode information into
  149. consideration to improve the reliability of file change detection.
  150. This is problematic for files located on sshfs and similar network file
  151. systems which do not provide stable inode numbers, such files will always
  152. be considered modified. You can use modes without `inode` in this case to
  153. improve performance, but reliability of change detection might be reduced.
  154. ctime vs. mtime: safety vs. speed
  155. - ctime is a rather safe way to detect changes to a file (metadata and contents)
  156. as it can not be set from userspace. But, a metadata-only change will already
  157. update the ctime, so there might be some unnecessary chunking/hashing even
  158. without content changes. Some filesystems do not support ctime (change time).
  159. - mtime usually works and only updates if file contents were changed. But mtime
  160. can be arbitrarily set from userspace, e.g. to set mtime back to the same value
  161. it had before a content change happened. This can be used maliciously as well as
  162. well-meant, but in both cases mtime based cache modes can be problematic.
  163. The mount points of filesystems or filesystem snapshots should be the same for every
  164. creation of a new archive to ensure fast operation. This is because the file cache that
  165. is used to determine changed files quickly uses absolute filenames.
  166. If this is not possible, consider creating a bind mount to a stable location.
  167. The ``--progress`` option shows (from left to right) Original, Compressed and Deduplicated
  168. (O, C and D, respectively), then the Number of files (N) processed so far, followed by
  169. the currently processed path.
  170. See the output of the "borg help patterns" command for more help on exclude patterns.
  171. See the output of the "borg help placeholders" command for more help on placeholders.
  172. .. man NOTES
  173. The ``--exclude`` patterns are not like tar. In tar ``--exclude`` .bundler/gems will
  174. exclude foo/.bundler/gems. In borg it will not, you need to use ``--exclude``
  175. '\*/.bundler/gems' to get the same effect. See ``borg help patterns`` for
  176. more information.
  177. In addition to using ``--exclude`` patterns, it is possible to use
  178. ``--exclude-if-present`` to specify the name of a filesystem object (e.g. a file
  179. or folder name) which, when contained within another folder, will prevent the
  180. containing folder from being backed up. By default, the containing folder and
  181. all of its contents will be omitted from the backup. If, however, you wish to
  182. only include the objects specified by ``--exclude-if-present`` in your backup,
  183. and not include any other contents of the containing folder, this can be enabled
  184. through using the ``--keep-exclude-tags`` option.
  185. Borg respects the nodump flag. Files flagged nodump will be marked as excluded (x)
  186. in ``--list`` output.
  187. Item flags
  188. ++++++++++
  189. ``--list`` outputs a list of all files, directories and other
  190. file system items it considered (no matter whether they had content changes
  191. or not). For each item, it prefixes a single-letter flag that indicates type
  192. and/or status of the item.
  193. If you are interested only in a subset of that output, you can give e.g.
  194. ``--filter=AME`` and it will only show regular files with A, M or E status (see
  195. below).
  196. A uppercase character represents the status of a regular file relative to the
  197. "files" cache (not relative to the repo -- this is an issue if the files cache
  198. is not used). Metadata is stored in any case and for 'A' and 'M' also new data
  199. chunks are stored. For 'U' all data chunks refer to already existing chunks.
  200. - 'A' = regular file, added (see also :ref:`a_status_oddity` in the FAQ)
  201. - 'M' = regular file, modified
  202. - 'U' = regular file, unchanged
  203. - 'E' = regular file, an error happened while accessing/reading *this* file
  204. A lowercase character means a file type other than a regular file,
  205. borg usually just stores their metadata:
  206. - 'd' = directory
  207. - 'b' = block device
  208. - 'c' = char device
  209. - 'h' = regular file, hardlink (to already seen inodes)
  210. - 's' = symlink
  211. - 'f' = fifo
  212. Other flags used include:
  213. - 'i' = backup data was read from standard input (stdin)
  214. - '-' = dry run, item was *not* backed up
  215. - 'x' = excluded, item was *not* backed up
  216. - '?' = missing status code (if you see this, please file a bug report!)