borg-create.1 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH BORG-CREATE 1 "2017-03-26" "" "borg backup tool"
  4. .SH NAME
  5. borg-create \- Create new archive
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  33. .SH SYNOPSIS
  34. .sp
  35. borg create <options> ARCHIVE PATH
  36. .SH DESCRIPTION
  37. .sp
  38. This command creates a backup archive containing all files found while recursively
  39. traversing all paths specified. Paths are added to the archive as they are given,
  40. that means if relative paths are desired, the command has to be run from the correct
  41. directory.
  42. .sp
  43. When giving \(aq\-\(aq as path, borg will read data from standard input and create a
  44. file \(aqstdin\(aq in the created archive from that data.
  45. .sp
  46. The archive will consume almost no disk space for files or parts of files that
  47. have already been stored in other archives.
  48. .sp
  49. The archive name needs to be unique. It must not end in \(aq.checkpoint\(aq or
  50. \(aq.checkpoint.N\(aq (with N being a number), because these names are used for
  51. checkpoints and treated in special ways.
  52. .sp
  53. In the archive name, you may use the following placeholders:
  54. {now}, {utcnow}, {fqdn}, {hostname}, {user} and some others.
  55. .sp
  56. To speed up pulling backups over sshfs and similar network file systems which do
  57. not provide correct inode information the \-\-ignore\-inode flag can be used. This
  58. potentially decreases reliability of change detection, while avoiding always reading
  59. all files on these file systems.
  60. .sp
  61. The mount points of filesystems or filesystem snapshots should be the same for every
  62. creation of a new archive to ensure fast operation. This is because the file cache that
  63. is used to determine changed files quickly uses absolute filenames.
  64. If this is not possible, consider creating a bind mount to a stable location.
  65. .sp
  66. See the output of the "borg help patterns" command for more help on exclude patterns.
  67. See the output of the "borg help placeholders" command for more help on placeholders.
  68. .SH OPTIONS
  69. .sp
  70. See \fIborg\-common(1)\fP for common options of Borg commands.
  71. .SS arguments
  72. .INDENT 0.0
  73. .TP
  74. .B ARCHIVE
  75. name of archive to create (must be also a valid directory name)
  76. .TP
  77. .B PATH
  78. paths to archive
  79. .UNINDENT
  80. .SS optional arguments
  81. .INDENT 0.0
  82. .TP
  83. .B \-n\fP,\fB \-\-dry\-run
  84. do not create a backup archive
  85. .TP
  86. .B \-s\fP,\fB \-\-stats
  87. print statistics for the created archive
  88. .TP
  89. .B \-p\fP,\fB \-\-progress
  90. show progress display while creating the archive, showing Original, Compressed and Deduplicated sizes, followed by the Number of files seen and the path being processed, default: False
  91. .TP
  92. .B \-\-list
  93. output verbose list of items (files, dirs, ...)
  94. .TP
  95. .BI \-\-filter \ STATUSCHARS
  96. only display items with the given status characters
  97. .TP
  98. .B \-\-json
  99. output stats as JSON (implies \-\-stats)
  100. .UNINDENT
  101. .SS Exclusion options
  102. .INDENT 0.0
  103. .TP
  104. .BI \-e \ PATTERN\fP,\fB \ \-\-exclude \ PATTERN
  105. exclude paths matching PATTERN
  106. .TP
  107. .BI \-\-exclude\-from \ EXCLUDEFILE
  108. read exclude patterns from EXCLUDEFILE, one per line
  109. .TP
  110. .B \-\-exclude\-caches
  111. exclude directories that contain a CACHEDIR.TAG file (\fI\%http://www.brynosaurus.com/cachedir/spec.html\fP)
  112. .TP
  113. .BI \-\-exclude\-if\-present \ NAME
  114. exclude directories that are tagged by containing a filesystem object with the given NAME
  115. .TP
  116. .B \-\-keep\-exclude\-tags\fP,\fB \-\-keep\-tag\-files
  117. if tag objects are specified with \-\-exclude\-if\-present, don\(aqt omit the tag objects themselves from the backup archive
  118. .TP
  119. .BI \-\-pattern \ PATTERN
  120. include/exclude paths matching PATTERN
  121. .TP
  122. .BI \-\-patterns\-from \ PATTERNFILE
  123. read include/exclude patterns from PATTERNFILE, one per line
  124. .UNINDENT
  125. .SS Filesystem options
  126. .INDENT 0.0
  127. .TP
  128. .B \-x\fP,\fB \-\-one\-file\-system
  129. stay in the same file system and do not store mount points of other file systems
  130. .TP
  131. .B \-\-numeric\-owner
  132. only store numeric user and group identifiers
  133. .TP
  134. .B \-\-noatime
  135. do not store atime into archive
  136. .TP
  137. .B \-\-noctime
  138. do not store ctime into archive
  139. .TP
  140. .B \-\-ignore\-inode
  141. ignore inode data in the file metadata cache used to detect unchanged files.
  142. .TP
  143. .B \-\-read\-special
  144. 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.
  145. .UNINDENT
  146. .SS Archive options
  147. .INDENT 0.0
  148. .TP
  149. .BI \-\-comment \ COMMENT
  150. add a comment text to the archive
  151. .TP
  152. .BI \-\-timestamp \ TIMESTAMP
  153. manually specify the archive creation date/time (UTC, yyyy\-mm\-ddThh:mm:ss format). alternatively, give a reference file/directory.
  154. .TP
  155. .BI \-c \ SECONDS\fP,\fB \ \-\-checkpoint\-interval \ SECONDS
  156. write checkpoint every SECONDS seconds (Default: 1800)
  157. .TP
  158. .BI \-\-chunker\-params \ PARAMS
  159. specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, HASH_MASK_BITS, HASH_WINDOW_SIZE). default: 19,23,21,4095
  160. .TP
  161. .BI \-C \ COMPRESSION\fP,\fB \ \-\-compression \ COMPRESSION
  162. select compression algorithm, see the output of the "borg help compression" command for details.
  163. .TP
  164. .BI \-\-compression\-from \ COMPRESSIONCONFIG
  165. read compression patterns from COMPRESSIONCONFIG, see the output of the "borg help compression" command for details.
  166. .UNINDENT
  167. .SH EXAMPLES
  168. .INDENT 0.0
  169. .INDENT 3.5
  170. .sp
  171. .nf
  172. .ft C
  173. # Backup ~/Documents into an archive named "my\-documents"
  174. $ borg create /path/to/repo::my\-documents ~/Documents
  175. # same, but list all files as we process them
  176. $ borg create \-\-list /path/to/repo::my\-documents ~/Documents
  177. # Backup ~/Documents and ~/src but exclude pyc files
  178. $ borg create /path/to/repo::my\-files \e
  179. ~/Documents \e
  180. ~/src \e
  181. \-\-exclude \(aq*.pyc\(aq
  182. # Backup home directories excluding image thumbnails (i.e. only
  183. # /home/*/.thumbnails is excluded, not /home/*/*/.thumbnails)
  184. $ borg create /path/to/repo::my\-files /home \e
  185. \-\-exclude \(aqre:^/home/[^/]+/\e.thumbnails/\(aq
  186. # Do the same using a shell\-style pattern
  187. $ borg create /path/to/repo::my\-files /home \e
  188. \-\-exclude \(aqsh:/home/*/.thumbnails\(aq
  189. # Backup the root filesystem into an archive named "root\-YYYY\-MM\-DD"
  190. # use zlib compression (good, but slow) \- default is lz4 (fast, low compression ratio)
  191. $ borg create \-C zlib,6 /path/to/repo::root\-{now:%Y\-%m\-%d} / \-\-one\-file\-system
  192. # Backup a remote host locally ("pull" style) using sshfs
  193. $ mkdir sshfs\-mount
  194. $ sshfs root@example.com:/ sshfs\-mount
  195. $ cd sshfs\-mount
  196. $ borg create /path/to/repo::example.com\-root\-{now:%Y\-%m\-%d} .
  197. $ cd ..
  198. $ fusermount \-u sshfs\-mount
  199. # Make a big effort in fine granular deduplication (big chunk management
  200. # overhead, needs a lot of RAM and disk space, see formula in internals
  201. # docs \- same parameters as borg < 1.0 or attic):
  202. $ borg create \-\-chunker\-params 10,23,16,4095 /path/to/repo::small /smallstuff
  203. # Backup a raw device (must not be active/in use/mounted at that time)
  204. $ dd if=/dev/sdx bs=10M | borg create /path/to/repo::my\-sdx \-
  205. # No compression (default)
  206. $ borg create /path/to/repo::arch ~
  207. # Super fast, low compression
  208. $ borg create \-\-compression lz4 /path/to/repo::arch ~
  209. # Less fast, higher compression (N = 0..9)
  210. $ borg create \-\-compression zlib,N /path/to/repo::arch ~
  211. # Even slower, even higher compression (N = 0..9)
  212. $ borg create \-\-compression lzma,N /path/to/repo::arch ~
  213. # Use short hostname, user name and current time in archive name
  214. $ borg create /path/to/repo::{hostname}\-{user}\-{now} ~
  215. # Similar, use the same datetime format as borg 1.1 will have as default
  216. $ borg create /path/to/repo::{hostname}\-{user}\-{now:%Y\-%m\-%dT%H:%M:%S} ~
  217. # As above, but add nanoseconds
  218. $ borg create /path/to/repo::{hostname}\-{user}\-{now:%Y\-%m\-%dT%H:%M:%S.%f} ~
  219. # Backing up relative paths by moving into the correct directory first
  220. $ cd /home/user/Documents
  221. # The root directory of the archive will be "projectA"
  222. $ borg create /path/to/repo::daily\-projectA\-{now:%Y\-%m\-%d} projectA
  223. .ft P
  224. .fi
  225. .UNINDENT
  226. .UNINDENT
  227. .SH NOTES
  228. .sp
  229. The \-\-exclude patterns are not like tar. In tar \-\-exclude .bundler/gems will
  230. exclude foo/.bundler/gems. In borg it will not, you need to use \-\-exclude
  231. \(aq*/.bundler/gems\(aq to get the same effect. See \fBborg help patterns\fP for
  232. more information.
  233. .sp
  234. In addition to using \fB\-\-exclude\fP patterns, it is possible to use
  235. \fB\-\-exclude\-if\-present\fP to specify the name of a filesystem object (e.g. a file
  236. or folder name) which, when contained within another folder, will prevent the
  237. containing folder from being backed up. By default, the containing folder and
  238. all of its contents will be omitted from the backup. If, however, you wish to
  239. only include the objects specified by \fB\-\-exclude\-if\-present\fP in your backup,
  240. and not include any other contents of the containing folder, this can be enabled
  241. through using the \fB\-\-keep\-exclude\-tags\fP option.
  242. .SS Item flags
  243. .sp
  244. \fB\-\-list\fP outputs a list of all files, directories and other
  245. file system items it considered (no matter whether they had content changes
  246. or not). For each item, it prefixes a single\-letter flag that indicates type
  247. and/or status of the item.
  248. .sp
  249. If you are interested only in a subset of that output, you can give e.g.
  250. \fB\-\-filter=AME\fP and it will only show regular files with A, M or E status (see
  251. below).
  252. .sp
  253. A uppercase character represents the status of a regular file relative to the
  254. "files" cache (not relative to the repo \-\- this is an issue if the files cache
  255. is not used). Metadata is stored in any case and for \(aqA\(aq and \(aqM\(aq also new data
  256. chunks are stored. For \(aqU\(aq all data chunks refer to already existing chunks.
  257. .INDENT 0.0
  258. .IP \(bu 2
  259. \(aqA\(aq = regular file, added (see also \fIa_status_oddity\fP in the FAQ)
  260. .IP \(bu 2
  261. \(aqM\(aq = regular file, modified
  262. .IP \(bu 2
  263. \(aqU\(aq = regular file, unchanged
  264. .IP \(bu 2
  265. \(aqE\(aq = regular file, an error happened while accessing/reading \fIthis\fP file
  266. .UNINDENT
  267. .sp
  268. A lowercase character means a file type other than a regular file,
  269. borg usually just stores their metadata:
  270. .INDENT 0.0
  271. .IP \(bu 2
  272. \(aqd\(aq = directory
  273. .IP \(bu 2
  274. \(aqb\(aq = block device
  275. .IP \(bu 2
  276. \(aqc\(aq = char device
  277. .IP \(bu 2
  278. \(aqh\(aq = regular file, hardlink (to already seen inodes)
  279. .IP \(bu 2
  280. \(aqs\(aq = symlink
  281. .IP \(bu 2
  282. \(aqf\(aq = fifo
  283. .UNINDENT
  284. .sp
  285. Other flags used include:
  286. .INDENT 0.0
  287. .IP \(bu 2
  288. \(aqi\(aq = backup data was read from standard input (stdin)
  289. .IP \(bu 2
  290. \(aq\-\(aq = dry run, item was \fInot\fP backed up
  291. .IP \(bu 2
  292. \(aqx\(aq = excluded, item was \fInot\fP backed up
  293. .IP \(bu 2
  294. \(aq?\(aq = missing status code (if you see this, please file a bug report!)
  295. .UNINDENT
  296. .SH SEE ALSO
  297. .sp
  298. \fIborg\-common(1)\fP, \fIborg\-delete(1)\fP, \fIborg\-prune(1)\fP, \fIborg\-check(1)\fP, \fIborg\-patterns(1)\fP, \fIborg\-placeholders(1)\fP, \fIborg\-compression(1)\fP
  299. .SH AUTHOR
  300. The Borg Collective
  301. .\" Generated by docutils manpage writer.
  302. .