borg-create.1 11 KB

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