borg-create.1 14 KB

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