faq.rst 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  1. .. include:: global.rst.inc
  2. .. highlight:: none
  3. .. _faq:
  4. Frequently asked questions
  5. ==========================
  6. Usage & Limitations
  7. ###################
  8. What is the difference between a repo on an external hard drive vs. repo on a server?
  9. -------------------------------------------------------------------------------------
  10. If Borg is running in client/server mode, the client uses SSH as a transport to
  11. talk to the remote agent, which is another Borg process (Borg is installed on
  12. the server, too). The Borg server is doing storage-related low-level repo
  13. operations (get, put, commit, check, compact), while the Borg client does the
  14. high-level stuff: deduplication, encryption, compression, dealing with
  15. archives, backups, restores, etc., which reduces the amount of data that goes
  16. over the network.
  17. When Borg is writing to a repo on a locally mounted remote file system, e.g.
  18. SSHFS, the Borg client only can do file system operations and has no agent
  19. running on the remote side, so *every* operation needs to go over the network,
  20. which is slower.
  21. Can I backup from multiple servers into a single repository?
  22. ------------------------------------------------------------
  23. Yes, this is *possible* from the technical standpoint, but it is
  24. *not recommended* from the security perspective. BorgBackup is
  25. built upon a defined :ref:`attack_model` that cannot provide its
  26. guarantees for multiple clients using the same repository. See
  27. :ref:`borg_security_critique` for a detailed explanation.
  28. Also, in order for the deduplication used by Borg to work, it
  29. needs to keep a local cache containing checksums of all file
  30. chunks already stored in the repository. This cache is stored in
  31. ``~/.cache/borg/``. If Borg detects that a repository has been
  32. modified since the local cache was updated it will need to rebuild
  33. the cache. This rebuild can be quite time consuming.
  34. So, yes it's possible. But it will be most efficient if a single
  35. repository is only modified from one place. Also keep in mind that
  36. Borg will keep an exclusive lock on the repository while creating
  37. or deleting archives, which may make *simultaneous* backups fail.
  38. Can I copy or synchronize my repo to another location?
  39. ------------------------------------------------------
  40. If you want to have redundant backup repositories (preferably at separate
  41. locations), the recommended way to do that is like this:
  42. - ``borg init repo1``
  43. - ``borg init repo2``
  44. - client machine ---borg create---> repo1
  45. - client machine ---borg create---> repo2
  46. This will create distinct repositories (separate repo ID, separate
  47. keys) and nothing bad happening in repo1 will influence repo2.
  48. Some people decide against above recommendation and create identical
  49. copies of a repo (using some copy / sync / clone tool).
  50. While this might be better than having no redundancy at all, you have
  51. to be very careful about how you do that and what you may / must not
  52. do with the result (if you decide against our recommendation).
  53. What you would get with this is:
  54. - client machine ---borg create---> repo
  55. - repo ---copy/sync---> copy-of-repo
  56. There is no special borg command to do the copying, you could just
  57. use any reliable tool that creates an identical copy (cp, rsync, rclone
  58. might be options).
  59. But think about whether that is really what you want. If something goes
  60. wrong in repo, you will have the same issue in copy-of-repo.
  61. Make sure you do the copy/sync while no backup is running, see
  62. :ref:`borg_with-lock` about how to do that.
  63. Also, you must not run borg against multiple instances of the same repo
  64. (like repo and copy-of-repo) as that would create severe issues:
  65. - Data loss: they have the same repository ID, so the borg client will
  66. think they are identical and e.g. use the same local cache for them
  67. (which is an issue if they happen to be not the same).
  68. See :issue:`4272` for an example.
  69. - Encryption security issues if you would update repo and copy-of-repo
  70. independently, due to AES counter reuse.
  71. See also: :ref:`faq_corrupt_repo`
  72. Which file types, attributes, etc. are *not* preserved?
  73. -------------------------------------------------------
  74. * UNIX domain sockets (because it does not make sense - they are
  75. meaningless without the running process that created them and the process
  76. needs to recreate them in any case). So, don't panic if your backup
  77. misses a UDS!
  78. * The precise on-disk (or rather: not-on-disk) representation of the holes
  79. in a sparse file.
  80. Archive creation has no special support for sparse files, holes are
  81. backed up as (deduplicated and compressed) runs of zero bytes.
  82. Archive extraction has optional support to extract all-zero chunks as
  83. holes in a sparse file.
  84. * Some filesystem specific attributes, like btrfs NOCOW, see :ref:`platforms`.
  85. * For hardlinked symlinks, the hardlinking can not be archived (and thus,
  86. the hardlinking will not be done at extraction time). The symlinks will
  87. be archived and extracted as non-hardlinked symlinks, see :issue:`2379`.
  88. Are there other known limitations?
  89. ----------------------------------
  90. - A single archive can only reference a limited volume of file/dir metadata,
  91. usually corresponding to tens or hundreds of millions of files/dirs.
  92. When trying to go beyond that limit, you will get a fatal IntegrityError
  93. exception telling that the (archive) object is too big.
  94. An easy workaround is to create multiple archives with fewer items each.
  95. See also the :ref:`archive_limitation` and :issue:`1452`.
  96. :ref:`borg_info` shows how large (relative to the maximum size) existing
  97. archives are.
  98. - borg extract only supports restoring into an empty destination. After that,
  99. the destination will exactly have the contents of the extracted archive.
  100. If you extract into a non-empty destination, borg will (for example) not
  101. remove files which are in the destination, but not in the archive.
  102. See :issue:`4598` for a workaround and more details.
  103. .. _checkpoints_parts:
  104. If a backup stops mid-way, does the already-backed-up data stay there?
  105. ----------------------------------------------------------------------
  106. Yes, Borg supports resuming backups.
  107. During a backup a special checkpoint archive named ``<archive-name>.checkpoint``
  108. is saved every checkpoint interval (the default value for this is 30
  109. minutes) containing all the data backed-up until that point.
  110. This checkpoint archive is a valid archive,
  111. but it is only a partial backup (not all files that you wanted to backup are
  112. contained in it). Having it in the repo until a successful, full backup is
  113. completed is useful because it references all the transmitted chunks up
  114. to the checkpoint. This means that in case of an interruption, you only need to
  115. retransfer the data since the last checkpoint.
  116. If a backup was interrupted, you normally do not need to do anything special,
  117. just invoke ``borg create`` as you always do. If the repository is still locked,
  118. you may need to run ``borg break-lock`` before the next backup. You may use the
  119. same archive name as in previous attempt or a different one (e.g. if you always
  120. include the current datetime), it does not matter.
  121. Borg always does full single-pass backups, so it will start again
  122. from the beginning - but it will be much faster, because some of the data was
  123. already stored into the repo (and is still referenced by the checkpoint
  124. archive), so it does not need to get transmitted and stored again.
  125. Once your backup has finished successfully, you can delete all
  126. ``<archive-name>.checkpoint`` archives. If you run ``borg prune``, it will
  127. also care for deleting unneeded checkpoints.
  128. Note: the checkpointing mechanism creates hidden, partial files in an archive,
  129. so that checkpoints even work while a big file is being processed.
  130. They are named ``<filename>.borg_part_<N>`` and all operations usually ignore
  131. these files, but you can make them considered by giving the option
  132. ``--consider-part-files``. You usually only need that option if you are
  133. really desperate (e.g. if you have no completed backup of that file and you'ld
  134. rather get a partial file extracted than nothing). You do **not** want to give
  135. that option under any normal circumstances.
  136. Note that checkpoints inside files are created only since version 1.1, make
  137. sure you have an up-to-date version of borgbackup if you want to continue
  138. instead of retransferring a huge file. In some cases, there is only an outdated
  139. version shipped with your distribution (e.g. Debian). See :ref:`installation`.
  140. How can I backup huge file(s) over a unstable connection?
  141. ---------------------------------------------------------
  142. This is not a problem anymore.
  143. For more details, see :ref:`checkpoints_parts`.
  144. My machine goes to sleep causing `Broken pipe`
  145. ----------------------------------------------
  146. When backing up your data over the network, your machine should not go to sleep.
  147. On macOS you can use `caffeinate` to avoid that.
  148. How can I restore huge file(s) over an unstable connection?
  149. -----------------------------------------------------------
  150. If you cannot manage to extract the whole big file in one go, you can extract
  151. all the part files and manually concatenate them together.
  152. For more details, see :ref:`checkpoints_parts`.
  153. .. _faq_corrupt_repo:
  154. My repository is corrupt, how can I restore from an older copy of it?
  155. ---------------------------------------------------------------------
  156. If your repositories are encrypted and have the same ID, the recommended method
  157. is to delete the corrupted repository, but keep its security info, and then copy
  158. the working repository to the same location:
  159. ::
  160. borg delete --keep-security-info /path/to/repo
  161. rsync -aH /path/to/repo-working/ /path/to/repo # Note the trailing slash.
  162. A plain delete command would remove the security info in
  163. ``~/.config/borg/security``, including the nonce value. In BorgBackup
  164. :ref:`security_encryption` is AES-CTR, where the nonce is a counter. When the
  165. working repo was used later for creating new archives, Borg would re-use nonce
  166. values due to starting from a lower counter value given by the older copy of the
  167. repository. To prevent this, the ``keep-security-info`` option is applied so
  168. that the client-side nonce counter is kept.
  169. Can Borg add redundancy to the backup data to deal with hardware malfunction?
  170. -----------------------------------------------------------------------------
  171. No, it can't. While that at first sounds like a good idea to defend against
  172. some defect HDD sectors or SSD flash blocks, dealing with this in a
  173. reliable way needs a lot of low-level storage layout information and
  174. control which we do not have (and also can't get, even if we wanted).
  175. So, if you need that, consider RAID or a filesystem that offers redundant
  176. storage or just make backups to different locations / different hardware.
  177. See also :issue:`225`.
  178. Can Borg verify data integrity of a backup archive?
  179. ---------------------------------------------------
  180. Yes, if you want to detect accidental data damage (like bit rot), use the
  181. ``check`` operation. It will notice corruption using CRCs and hashes.
  182. If you want to be able to detect malicious tampering also, use an encrypted
  183. repo. It will then be able to check using CRCs and HMACs.
  184. Can I use Borg on SMR hard drives?
  185. ----------------------------------
  186. SMR (shingled magnetic recording) hard drives are very different from
  187. regular hard drives. Applications have to behave in certain ways or
  188. performance will be heavily degraded.
  189. Borg 1.1 ships with default settings suitable for SMR drives,
  190. and has been successfully tested on *Seagate Archive v2* drives
  191. using the ext4 file system.
  192. Some Linux kernel versions between 3.19 and 4.5 had various bugs
  193. handling device-managed SMR drives, leading to IO errors, unresponsive
  194. drives and unreliable operation in general.
  195. For more details, refer to :issue:`2252`.
  196. .. _faq-integrityerror:
  197. I get an IntegrityError or similar - what now?
  198. ----------------------------------------------
  199. A single error does not necessarily indicate bad hardware or a Borg
  200. bug. All hardware exhibits a bit error rate (BER). Hard drives are typically
  201. specified as exhibiting fewer than one error every 12 to 120 TB
  202. (one bit error in 10e14 to 10e15 bits). The specification is often called
  203. *unrecoverable read error rate* (URE rate).
  204. Apart from these very rare errors there are two main causes of errors:
  205. (i) Defective hardware: described below.
  206. (ii) Bugs in software (Borg, operating system, libraries):
  207. Ensure software is up to date.
  208. Check whether the issue is caused by any fixed bugs described in
  209. :ref:`important_notes`.
  210. .. rubric:: Finding defective hardware
  211. .. note::
  212. Hardware diagnostics are operating system dependent and do not
  213. apply universally. The commands shown apply for popular Unix-like
  214. systems. Refer to your operating system's manual.
  215. Checking hard drives
  216. Find the drive containing the repository and use *findmnt*, *mount* or *lsblk*
  217. to learn the device path (typically */dev/...*) of the drive.
  218. Then, smartmontools can retrieve self-diagnostics of the drive in question::
  219. # smartctl -a /dev/sdSomething
  220. The *Offline_Uncorrectable*, *Current_Pending_Sector* and *Reported_Uncorrect*
  221. attributes indicate data corruption. A high *UDMA_CRC_Error_Count* usually
  222. indicates a bad cable.
  223. I/O errors logged by the system (refer to the system journal or
  224. dmesg) can point to issues as well. I/O errors only affecting the
  225. file system easily go unnoticed, since they are not reported to
  226. applications (e.g. Borg), while these errors can still corrupt data.
  227. Drives can corrupt some sectors in one event, while remaining
  228. reliable otherwise. Conversely, drives can fail completely with no
  229. advance warning. If in doubt, copy all data from the drive in
  230. question to another drive -- just in case it fails completely.
  231. If any of these are suspicious, a self-test is recommended::
  232. # smartctl -t long /dev/sdSomething
  233. Running ``fsck`` if not done already might yield further insights.
  234. Checking memory
  235. Intermittent issues, such as ``borg check`` finding errors
  236. inconsistently between runs, are frequently caused by bad memory.
  237. Run memtest86+ (or an equivalent memory tester) to verify that
  238. the memory subsystem is operating correctly.
  239. Checking processors
  240. Processors rarely cause errors. If they do, they are usually overclocked
  241. or otherwise operated outside their specifications. We do not recommend to
  242. operate hardware outside its specifications for productive use.
  243. Tools to verify correct processor operation include Prime95 (mprime), linpack,
  244. and the `Intel Processor Diagnostic Tool
  245. <https://downloadcenter.intel.com/download/19792/Intel-Processor-Diagnostic-Tool>`_
  246. (applies only to Intel processors).
  247. .. rubric:: Repairing a damaged repository
  248. With any defective hardware found and replaced, the damage done to the repository
  249. needs to be ascertained and fixed.
  250. :ref:`borg_check` provides diagnostics and ``--repair`` options for repositories with
  251. issues. We recommend to first run without ``--repair`` to assess the situation.
  252. If the found issues and proposed repairs seem right, re-run "check" with ``--repair`` enabled.
  253. How probable is it to get a hash collision problem?
  254. ---------------------------------------------------
  255. If you noticed, there are some issues (:issue:`170` (**warning: hell**) and :issue:`4884`)
  256. about the probability of a chunk having the same hash as another chunk, making the file
  257. corrupted because it grabbed the wrong chunk. This is called the `Birthday Problem
  258. <https://en.wikipedia.org/wiki/Birthday_problem>`_.
  259. There is a lot of probability in here so, I can give you my interpretation of
  260. such math but it's honestly better that you read it yourself and grab your own
  261. resolution from that.
  262. Assuming that all your chunks have a size of :math:`2^{21}` bytes (approximately 2.1 MB)
  263. and we have a "perfect" hash algorithm, we can think that the probability of collision
  264. would be of :math:`p^2/2^{n+1}` then, using SHA-256 (:math:`n=256`) and for example
  265. we have 1000 million chunks (:math:`p=10^9`) (1000 million chunks would be about 2100TB).
  266. The probability would be around to 0.0000000000000000000000000000000000000000000000000000000000043.
  267. A mass-murderer space rock happens about once every 30 million years on average.
  268. This leads to a probability of such an event occurring in the next second to about :math:`10^{-15}`.
  269. That's **45** orders of magnitude more probable than the SHA-256 collision. Briefly stated,
  270. if you find SHA-256 collisions scary then your priorities are wrong. This example was grabbed from
  271. `this SO answer <https://stackoverflow.com/a/4014407/13359375>`_, it's great honestly.
  272. Still, the real question is if Borg tries to not make this happen?
  273. Well... it used to not check anything but there was a feature added which saves the size
  274. of the chunks too, so the size of the chunks is compared to the size that you got with the
  275. hash and if the check says there is a mismatch it will raise an exception instead of corrupting
  276. the file. This doesn't save us from everything but reduces the chances of corruption.
  277. There are other ways of trying to escape this but it would affect performance so much that
  278. it wouldn't be worth it and it would contradict Borg's design, so if you don't want this to
  279. happen, simply don't use Borg.
  280. Why is the time elapsed in the archive stats different from wall clock time?
  281. ----------------------------------------------------------------------------
  282. Borg needs to write the time elapsed into the archive metadata before finalizing
  283. the archive, compacting the segments, and committing the repo & cache. This means
  284. when Borg is run with e.g. the ``time`` command, the duration shown in the archive
  285. stats may be shorter than the full time the command runs for.
  286. How do I configure different prune policies for different directories?
  287. ----------------------------------------------------------------------
  288. Say you want to prune ``/var/log`` faster than the rest of
  289. ``/``. How do we implement that? The answer is to backup to different
  290. archive *names* and then implement different prune policies for
  291. different prefixes. For example, you could have a script that does::
  292. borg create --exclude /var/log $REPOSITORY:main-$(date +%Y-%m-%d) /
  293. borg create $REPOSITORY:logs-$(date +%Y-%m-%d) /var/log
  294. Then you would have two different prune calls with different policies::
  295. borg prune --verbose --list -d 30 --prefix main- "$REPOSITORY"
  296. borg prune --verbose --list -d 7 --prefix logs- "$REPOSITORY"
  297. This will keep 7 days of logs and 30 days of everything else. Borg 1.1
  298. also supports the ``--glob-archives`` parameter.
  299. How do I remove files from an existing backup?
  300. ----------------------------------------------
  301. A file is only removed from a BorgBackup repository if all archives that contain
  302. the file are deleted and the corresponding data chunks are removed from the
  303. repository There are two ways how to remove files from a repository.
  304. 1. Use :ref:`borg_delete` to remove all archives that contain the files. This
  305. will of course delete everything in the archive, not only some files.
  306. 2. If you really want to remove only some specific files, you can run the
  307. :ref:`borg_recreate` command to rewrite all archives with a different
  308. ``--exclude`` pattern. See the examples in the manpage for more information.
  309. Finally, run :ref:`borg_compact` with the ``--threshold 0`` option to delete the
  310. data chunks from the repository.
  311. Can I safely change the compression level or algorithm?
  312. --------------------------------------------------------
  313. The compression level and algorithm don't affect deduplication. Chunk ID hashes
  314. are calculated *before* compression. New compression settings
  315. will only be applied to new chunks, not existing chunks. So it's safe
  316. to change them.
  317. Security
  318. ########
  319. .. _borg_security_critique:
  320. Isn't BorgBackup's AES-CTR crypto broken?
  321. -----------------------------------------
  322. If a nonce (counter) value is reused, AES-CTR mode crypto is broken.
  323. To exploit the AES counter management issue, an attacker would need to have
  324. access to the borg repository.
  325. By tampering with the repo, the attacker could bring the repo into a state so
  326. that it reports a lower "highest used counter value" than the one that actually
  327. was used. The client would usually notice that, because it rather trusts the
  328. clientside stored "highest used counter value" than trusting the server.
  329. But there are situations, where this is simply not possible:
  330. - If clients A and B used the repo, the client A can only know its own highest
  331. CTR value, but not the one produced by B. That is only known to (B and) the
  332. server (the repo) and thus the client A needs to trust the server about the
  333. value produced by B in that situation. You can't do much about this except
  334. not having multiple clients per repo.
  335. - Even if there is only one client, if client-side information is completely
  336. lost (e.g. due to disk defect), the client also needs to trust the value from
  337. server side. You can avoid this by not continuing to write to the repository
  338. after you have lost clientside borg information.
  339. .. _home_config_borg:
  340. How important is the $HOME/.config/borg directory?
  341. --------------------------------------------------
  342. The Borg config directory has content that you should take care of:
  343. ``security`` subdirectory
  344. Each directory here represents one Borg repository by its ID and contains the last known status.
  345. If a repository's status is different from this information at the beginning of BorgBackup
  346. operation, Borg outputs warning messages and asks for confirmation, so make sure you do not lose
  347. or manipulate these files. However, apart from those warnings, a loss of these files can be
  348. recovered.
  349. ``keys`` subdirectory
  350. In this directory all your repository keyfiles are stored. You MUST make sure to have an
  351. independent backup of these keyfiles, otherwise you cannot access your backups anymore if you lose
  352. them. You also MUST keep these files secret; everyone who gains access to your repository and has
  353. the corresponding keyfile (and the key passphrase) can extract it.
  354. Make sure that only you have access to the Borg config directory.
  355. .. _cache_security:
  356. Do I need to take security precautions regarding the cache?
  357. -----------------------------------------------------------
  358. The cache contains a lot of metadata information about the files in
  359. your repositories and it is not encrypted.
  360. However, the assumption is that the cache is being stored on the very
  361. same system which also contains the original files which are being
  362. backed up. So someone with access to the cache files would also have
  363. access the the original files anyway.
  364. The Internals section contains more details about :ref:`cache`. If you ever need to move the cache
  365. to a different location, this can be achieved by using the appropriate :ref:`env_vars`.
  366. How can I specify the encryption passphrase programmatically?
  367. -------------------------------------------------------------
  368. There are several ways to specify a passphrase without human intervention:
  369. Setting ``BORG_PASSPHRASE``
  370. The passphrase can be specified using the ``BORG_PASSPHRASE`` enviroment variable.
  371. This is often the simplest option, but can be insecure if the script that sets it
  372. is world-readable.
  373. .. _password_env:
  374. .. note:: Be careful how you set the environment; using the ``env``
  375. command, a ``system()`` call or using inline shell scripts
  376. (e.g. ``BORG_PASSPHRASE=hunter2 borg ...``)
  377. might expose the credentials in the process list directly
  378. and they will be readable to all users on a system. Using
  379. ``export`` in a shell script file should be safe, however, as
  380. the environment of a process is `accessible only to that
  381. user
  382. <https://security.stackexchange.com/questions/14000/environment-variable-accessibility-in-linux/14009#14009>`_.
  383. Using ``BORG_PASSCOMMAND`` with a properly permissioned file
  384. Another option is to create a file with a password in it in your home
  385. directory and use permissions to keep anyone else from reading it. For
  386. example, first create a key::
  387. head -c 32 /dev/urandom | base64 -w 0 > ~/.borg-passphrase
  388. chmod 400 ~/.borg-passphrase
  389. Then in an automated script one can put::
  390. export BORG_PASSCOMMAND="cat $HOME/.borg-passphrase"
  391. and Borg will automatically use that passphrase.
  392. Using keyfile-based encryption with a blank passphrase
  393. It is possible to encrypt your repository in ``keyfile`` mode instead of the default
  394. ``repokey`` mode and use a blank passphrase for the key file (simply press Enter twice
  395. when ``borg init`` asks for the password). See :ref:`encrypted_repos`
  396. for more details.
  397. Using ``BORG_PASSCOMMAND`` with macOS Keychain
  398. macOS has a native manager for secrets (such as passphrases) which is safer
  399. than just using a file as it is encrypted at rest and unlocked manually
  400. (fortunately, the login keyring automatically unlocks when you login). With
  401. the built-in ``security`` command, you can access it from the command line,
  402. making it useful for ``BORG_PASSCOMMAND``.
  403. First generate a passphrase and use ``security`` to save it to your login
  404. (default) keychain::
  405. security add-generic-password -D secret -U -a $USER -s borg-passphrase -w $(head -c 32 /dev/urandom | base64 -w 0)
  406. In your backup script retrieve it in the ``BORG_PASSCOMMAND``::
  407. export BORG_PASSCOMMAND="security find-generic-password -a $USER -s borg-passphrase -w"
  408. Using ``BORG_PASSCOMMAND`` with GNOME Keyring
  409. GNOME also has a keyring daemon that can be used to store a Borg passphrase.
  410. First ensure ``libsecret-tools``, ``gnome-keyring`` and ``libpam-gnome-keyring``
  411. are installed. If ``libpam-gnome-keyring`` wasn't already installed, ensure it
  412. runs on login::
  413. sudo sh -c "echo session optional pam_gnome_keyring.so auto_start >> /etc/pam.d/login"
  414. sudo sh -c "echo password optional pam_gnome_keyring.so >> /etc/pam.d/passwd"
  415. # you may need to relogin afterwards to activate the login keyring
  416. Then add a secret to the login keyring::
  417. head -c 32 /dev/urandom | base64 -w 0 | secret-tool store borg-repository repo-name --label="Borg Passphrase"
  418. If a dialog box pops up prompting you to pick a password for a new keychain, use your
  419. login password. If there is a checkbox for automatically unlocking on login, check it
  420. to allow backups without any user intervention whatsoever.
  421. Once the secret is saved, retrieve it in a backup script using ``BORG_PASSCOMMAND``::
  422. export BORG_PASSCOMMAND="secret-tool lookup borg-repository repo-name"
  423. .. note:: For this to automatically unlock the keychain it must be run
  424. in the ``dbus`` session of an unlocked terminal; for example, running a backup
  425. script as a ``cron`` job might not work unless you also ``export DISPLAY=:0``
  426. so ``secret-tool`` can pick up your open session. `It gets even more complicated`__
  427. when you are running the tool as a different user (e.g. running a backup as root
  428. with the password stored in the user keyring).
  429. __ https://github.com/borgbackup/borg/pull/2837#discussion_r127641330
  430. Using ``BORG_PASSCOMMAND`` with KWallet
  431. KDE also has a keychain feature in the form of KWallet. The command-line tool
  432. ``kwalletcli`` can be used to store and retrieve secrets. Ensure ``kwalletcli``
  433. is installed, generate a passphrase, and store it in your "wallet"::
  434. head -c 32 /dev/urandom | base64 -w 0 | kwalletcli -Pe borg-passphrase -f Passwords
  435. Once the secret is saved, retrieve it in a backup script using ``BORG_PASSCOMMAND``::
  436. export BORG_PASSCOMMAND="kwalletcli -e borg-passphrase -f Passwords"
  437. When backing up to remote encrypted repos, is encryption done locally?
  438. ----------------------------------------------------------------------
  439. Yes, file and directory metadata and data is locally encrypted, before
  440. leaving the local machine. We do not mean the transport layer encryption
  441. by that, but the data/metadata itself. Transport layer encryption (e.g.
  442. when ssh is used as a transport) applies additionally.
  443. When backing up to remote servers, do I have to trust the remote server?
  444. ------------------------------------------------------------------------
  445. Yes and No.
  446. No, as far as data confidentiality is concerned - if you use encryption,
  447. all your files/dirs data and metadata are stored in their encrypted form
  448. into the repository.
  449. Yes, as an attacker with access to the remote server could delete (or
  450. otherwise make unavailable) all your backups.
  451. How can I protect against a hacked backup client?
  452. -------------------------------------------------
  453. Assume you backup your backup client machine C to the backup server S and
  454. C gets hacked. In a simple push setup, the attacker could then use borg on
  455. C to delete all backups residing on S.
  456. These are your options to protect against that:
  457. - Do not allow to permanently delete data from the repo, see :ref:`append_only_mode`.
  458. - Use a pull-mode setup using ``ssh -R``, see :ref:`pull_backup` for more informations.
  459. - Mount C's filesystem on another machine and then create a backup of it.
  460. - Do not give C filesystem-level access to S.
  461. See :ref:`hosting_repositories` for a detailed protection guide.
  462. How can I protect against a hacked backup server?
  463. -------------------------------------------------
  464. Just in case you got the impression that pull-mode backups are way more safe
  465. than push-mode, you also need to consider the case that your backup server S
  466. gets hacked. In case S has access to a lot of clients C, that might bring you
  467. into even bigger trouble than a hacked backup client in the previous FAQ entry.
  468. These are your options to protect against that:
  469. - Use the standard push-mode setup (see also previous FAQ entry).
  470. - Mount (the repo part of) S's filesystem on C.
  471. - Do not give S file-system level access to C.
  472. - Have your backup server at a well protected place (maybe not reachable from
  473. the internet), configure it safely, apply security updates, monitor it, ...
  474. How can I protect against theft, sabotage, lightning, fire, ...?
  475. ----------------------------------------------------------------
  476. In general: if your only backup medium is nearby the backupped machine and
  477. always connected, you can easily get into trouble: they likely share the same
  478. fate if something goes really wrong.
  479. Thus:
  480. - have multiple backup media
  481. - have media disconnected from network, power, computer
  482. - have media at another place
  483. - have a relatively recent backup on your media
  484. How do I report a security issue with Borg?
  485. -------------------------------------------
  486. Send a private email to the :ref:`security contact <security-contact>`
  487. if you think you have discovered a security issue.
  488. Please disclose security issues responsibly.
  489. Common issues
  490. #############
  491. Why does Borg extract hang after some time?
  492. -------------------------------------------
  493. When I do a ``borg extract``, after a while all activity stops, no cpu usage,
  494. no downloads.
  495. This may happen when the SSH connection is stuck on server side. You can
  496. configure SSH on client side to prevent this by sending keep-alive requests,
  497. for example in ~/.ssh/config:
  498. ::
  499. Host borg.example.com
  500. # Client kills connection after 3*30 seconds without server response:
  501. ServerAliveInterval 30
  502. ServerAliveCountMax 3
  503. You can also do the opposite and configure SSH on server side in
  504. /etc/ssh/sshd_config, to make the server send keep-alive requests to the client:
  505. ::
  506. # Server kills connection after 3*30 seconds without client response:
  507. ClientAliveInterval 30
  508. ClientAliveCountMax 3
  509. How can I deal with my very unstable SSH connection?
  510. ----------------------------------------------------
  511. If you have issues with lost connections during long-running borg commands, you
  512. could try to work around:
  513. - Make partial extracts like ``borg extract REPO PATTERN`` to do multiple
  514. smaller extraction runs that complete before your connection has issues.
  515. - Try using ``borg mount REPO MOUNTPOINT`` and ``rsync -avH`` from
  516. ``MOUNTPOINT`` to your desired extraction directory. If the connection breaks
  517. down, just repeat that over and over again until rsync does not find anything
  518. to do any more. Due to the way borg mount works, this might be less efficient
  519. than borg extract for bigger volumes of data.
  520. Why do I get "connection closed by remote" after a while?
  521. ---------------------------------------------------------
  522. When doing a backup to a remote server (using a ssh: repo URL), it sometimes
  523. stops after a while (some minutes, hours, ... - not immediately) with
  524. "connection closed by remote" error message. Why?
  525. That's a good question and we are trying to find a good answer in :issue:`636`.
  526. Why am I seeing idle borg serve processes on the repo server?
  527. -------------------------------------------------------------
  528. Maybe the ssh connection between client and server broke down and that was not
  529. yet noticed on the server. Try these settings:
  530. ::
  531. # /etc/ssh/sshd_config on borg repo server - kill connection to client
  532. # after ClientAliveCountMax * ClientAliveInterval seconds with no response
  533. ClientAliveInterval 20
  534. ClientAliveCountMax 3
  535. If you have multiple borg create ... ; borg create ... commands in a already
  536. serialized way in a single script, you need to give them ``--lock-wait N`` (with N
  537. being a bit more than the time the server needs to terminate broken down
  538. connections and release the lock).
  539. .. _disable_archive_chunks:
  540. The borg cache eats way too much disk space, what can I do?
  541. -----------------------------------------------------------
  542. This may especially happen if borg needs to rebuild the local "chunks" index -
  543. either because it was removed, or because it was not coherent with the
  544. repository state any more (e.g. because another borg instance changed the
  545. repository).
  546. To optimize this rebuild process, borg caches per-archive information in the
  547. ``chunks.archive.d/`` directory. It won't help the first time it happens, but it
  548. will make the subsequent rebuilds faster (because it needs to transfer less data
  549. from the repository). While being faster, the cache needs quite some disk space,
  550. which might be unwanted.
  551. There is a temporary (but maybe long lived) hack to avoid using lots of disk
  552. space for chunks.archive.d (see :issue:`235` for details):
  553. ::
  554. # this assumes you are working with the same user as the backup.
  555. cd ~/.cache/borg/$(borg config /path/to/repo id)
  556. rm -rf chunks.archive.d ; touch chunks.archive.d
  557. This deletes all the cached archive chunk indexes and replaces the directory
  558. that kept them with a file, so borg won't be able to store anything "in" there
  559. in future.
  560. This has some pros and cons, though:
  561. - much less disk space needs for ~/.cache/borg.
  562. - chunk cache resyncs will be slower as it will have to transfer chunk usage
  563. metadata for all archives from the repository (which might be slow if your
  564. repo connection is slow) and it will also have to build the hashtables from
  565. that data.
  566. chunk cache resyncs happen e.g. if your repo was written to by another
  567. machine (if you share same backup repo between multiple machines) or if
  568. your local chunks cache was lost somehow.
  569. The long term plan to improve this is called "borgception", see :issue:`474`.
  570. Can I backup my root partition (/) with Borg?
  571. ---------------------------------------------
  572. Backing up your entire root partition works just fine, but remember to
  573. exclude directories that make no sense to backup, such as /dev, /proc,
  574. /sys, /tmp and /run, and to use ``--one-file-system`` if you only want to
  575. backup the root partition (and not any mounted devices e.g.).
  576. If it crashes with a UnicodeError, what can I do?
  577. -------------------------------------------------
  578. Check if your encoding is set correctly. For most POSIX-like systems, try::
  579. export LANG=en_US.UTF-8 # or similar, important is correct charset
  580. I can't extract non-ascii filenames by giving them on the commandline!?
  581. -----------------------------------------------------------------------
  582. This might be due to different ways to represent some characters in unicode
  583. or due to other non-ascii encoding issues.
  584. If you run into that, try this:
  585. - avoid the non-ascii characters on the commandline by e.g. extracting
  586. the parent directory (or even everything)
  587. - mount the repo using FUSE and use some file manager
  588. .. _expected_performance:
  589. What's the expected backup performance?
  590. ---------------------------------------
  591. A first backup will usually be somehow "slow" because there is a lot of data
  592. to process. Performance here depends on a lot of factors, so it is hard to
  593. give specific numbers.
  594. Subsequent backups are usually very fast if most files are unchanged and only
  595. a few are new or modified. The high performance on unchanged files primarily depends
  596. only on a few factors (like fs recursion + metadata reading performance and the
  597. files cache working as expected) and much less on other factors.
  598. E.g., for this setup:
  599. - server grade machine (4C/8T 2013 Xeon, 64GB RAM, 2x good 7200RPM disks)
  600. - local zfs filesystem (mirrored) containing the backup source data
  601. - repository is remote (does not matter much for unchanged files)
  602. - backup job runs while machine is otherwise idle
  603. The observed performance is that |project_name| can process about
  604. **1 million unchanged files (and a few small changed ones) in 4 minutes!**
  605. If you are seeing much less than that in similar circumstances, read the next
  606. few FAQ entries below.
  607. .. _slow_backup:
  608. Why is backup slow for me?
  609. --------------------------
  610. So, if you feel your |project_name| backup is too slow somehow, you should find out why.
  611. The usual way to approach this is to add ``--list --filter=AME --stats`` to your
  612. ``borg create`` call to produce more log output, including a file list (with file status
  613. characters) and also some statistics at the end of the backup.
  614. Then you do the backup and look at the log output:
  615. - stats: Do you really have little changes or are there more changes than you thought?
  616. In the stats you can see the overall volume of changed data, which needed to be
  617. added to the repo. If that is a lot, that can be the reason why it is slow.
  618. - ``A`` status ("added") in the file list:
  619. If you see that often, you have a lot of new files (files that |project_name| did not find
  620. in the files cache). If you think there is something wrong with that (the file was there
  621. already in the previous backup), please read the FAQ entries below.
  622. - ``M`` status ("modified") in the file list:
  623. If you see that often, |project_name| thinks that a lot of your files might be modified
  624. (|project_name| found them in the files cache, but the metadata read from the filesystem did
  625. not match the metadata stored in the files cache).
  626. In such a case, |project_name| will need to process the files' contents completely, which is
  627. much slower than processing unmodified files (|project_name| does not read their contents!).
  628. The metadata values used in this comparison are determined by the ``--files-cache`` option
  629. and could be e.g. size, ctime and inode number (see the ``borg create`` docs for more
  630. details and potential issues).
  631. You can use the ``stat`` command on files to manually look at fs metadata to debug if
  632. there is any unexpected change triggering the ``M`` status.
  633. See also the next few FAQ entries for more details.
  634. .. _a_status_oddity:
  635. I am seeing 'A' (added) status for an unchanged file!?
  636. ------------------------------------------------------
  637. The files cache is used to determine whether Borg already
  638. "knows" / has backed up a file and if so, to skip the file from
  639. chunking. It does intentionally *not* contain files that have a timestamp
  640. same as the newest timestamp in the created archive.
  641. So, if you see an 'A' status for unchanged file(s), they are likely the files
  642. with the most recent timestamp in that archive.
  643. This is expected: it is to avoid data loss with files that are backed up from
  644. a snapshot and that are immediately changed after the snapshot (but within
  645. timestamp granularity time, so the timestamp would not change). Without the code that
  646. removes these files from the files cache, the change that happened right after
  647. the snapshot would not be contained in the next backup as Borg would
  648. think the file is unchanged.
  649. This does not affect deduplication, the file will be chunked, but as the chunks
  650. will often be the same and already stored in the repo (except in the above
  651. mentioned rare condition), it will just re-use them as usual and not store new
  652. data chunks.
  653. If you want to avoid unnecessary chunking, just create or touch a small or
  654. empty file in your backup source file set (so that one has the latest timestamp,
  655. not your 50GB VM disk image) and, if you do snapshots, do the snapshot after
  656. that.
  657. Since only the files cache is used in the display of files status,
  658. those files are reported as being added when, really, chunks are
  659. already used.
  660. By default, ctime (change time) is used for the timestamps to have a rather
  661. safe change detection (see also the --files-cache option).
  662. Furthermore, pathnames recorded in files cache are always absolute, even if you
  663. specify source directories with relative pathname. If relative pathnames are
  664. stable, but absolute are not (for example if you mount a filesystem without
  665. stable mount points for each backup or if you are running the backup from a
  666. filesystem snapshot whose name is not stable), borg will assume that files are
  667. different and will report them as 'added', even though no new chunks will be
  668. actually recorded for them. To avoid this, you could bind mount your source
  669. directory in a directory with the stable path.
  670. .. _always_chunking:
  671. It always chunks all my files, even unchanged ones!
  672. ---------------------------------------------------
  673. Borg maintains a files cache where it remembers the timestamp, size and
  674. inode of files. When Borg does a new backup and starts processing a
  675. file, it first looks whether the file has changed (compared to the values
  676. stored in the files cache). If the values are the same, the file is assumed
  677. unchanged and thus its contents won't get chunked (again).
  678. Borg can't keep an infinite history of files of course, thus entries
  679. in the files cache have a "maximum time to live" which is set via the
  680. environment variable BORG_FILES_CACHE_TTL (and defaults to 20).
  681. Every time you do a backup (on the same machine, using the same user), the
  682. cache entries' ttl values of files that were not "seen" are incremented by 1
  683. and if they reach BORG_FILES_CACHE_TTL, the entry is removed from the cache.
  684. So, for example, if you do daily backups of 26 different data sets A, B,
  685. C, ..., Z on one machine (using the default TTL), the files from A will be
  686. already forgotten when you repeat the same backups on the next day and it
  687. will be slow because it would chunk all the files each time. If you set
  688. BORG_FILES_CACHE_TTL to at least 26 (or maybe even a small multiple of that),
  689. it would be much faster.
  690. Another possible reason is that files don't always have the same path, for
  691. example if you mount a filesystem without stable mount points for each backup
  692. or if you are running the backup from a filesystem snapshot whose name is not
  693. stable. If the directory where you mount a filesystem is different every time,
  694. Borg assumes they are different files. This is true even if you backup these
  695. files with relative pathnames - borg uses full pathnames in files cache regardless.
  696. Is there a way to limit bandwidth with Borg?
  697. --------------------------------------------
  698. To limit upload (i.e. :ref:`borg_create`) bandwidth, use the
  699. ``--remote-ratelimit`` option.
  700. There is no built-in way to limit *download*
  701. (i.e. :ref:`borg_extract`) bandwidth, but limiting download bandwidth
  702. can be accomplished with pipeviewer_:
  703. Create a wrapper script: /usr/local/bin/pv-wrapper
  704. ::
  705. #!/bin/sh
  706. ## -q, --quiet do not output any transfer information at all
  707. ## -L, --rate-limit RATE limit transfer to RATE bytes per second
  708. RATE=307200
  709. pv -q -L $RATE | "$@"
  710. Add BORG_RSH environment variable to use pipeviewer wrapper script with ssh.
  711. ::
  712. export BORG_RSH='/usr/local/bin/pv-wrapper ssh'
  713. Now Borg will be bandwidth limited. The nice thing about ``pv`` is that you can
  714. change rate-limit on the fly:
  715. ::
  716. pv -R $(pidof pv) -L 102400
  717. .. _pipeviewer: http://www.ivarch.com/programs/pv.shtml
  718. How can I avoid unwanted base directories getting stored into archives?
  719. -----------------------------------------------------------------------
  720. Possible use cases:
  721. - Another file system is mounted and you want to backup it with original paths.
  722. - You have created a BTRFS snapshot in a ``/.snapshots`` directory for backup.
  723. To achieve this, run ``borg create`` within the mountpoint/snapshot directory:
  724. ::
  725. # Example: Some file system mounted in /mnt/rootfs.
  726. cd /mnt/rootfs
  727. borg create /path/to/repo::rootfs_backup .
  728. I am having troubles with some network/FUSE/special filesystem, why?
  729. --------------------------------------------------------------------
  730. Borg is doing nothing special in the filesystem, it only uses very
  731. common and compatible operations (even the locking is just "rename").
  732. So, if you are encountering issues like slowness, corruption or malfunction
  733. when using a specific filesystem, please try if you can reproduce the issues
  734. with a local (non-network) and proven filesystem (like ext4 on Linux).
  735. If you can't reproduce the issue then, you maybe have found an issue within
  736. the filesystem code you used (not with Borg). For this case, it is
  737. recommended that you talk to the developers / support of the network fs and
  738. maybe open an issue in their issue tracker. Do not file an issue in the
  739. Borg issue tracker.
  740. If you can reproduce the issue with the proven filesystem, please file an
  741. issue in the Borg issue tracker about that.
  742. Why does running 'borg check --repair' warn about data loss?
  743. ------------------------------------------------------------
  744. Repair usually works for recovering data in a corrupted archive. However,
  745. it's impossible to predict all modes of corruption. In some very rare
  746. instances, such as malfunctioning storage hardware, additional repo
  747. corruption may occur. If you can't afford to lose the repo, it's strongly
  748. recommended that you perform repair on a copy of the repo.
  749. In other words, the warning is there to emphasize that Borg:
  750. - Will perform automated routines that modify your backup repository
  751. - Might not actually fix the problem you are experiencing
  752. - Might, in very rare cases, further corrupt your repository
  753. In the case of malfunctioning hardware, such as a drive or USB hub
  754. corrupting data when read or written, it's best to diagnose and fix the
  755. cause of the initial corruption before attempting to repair the repo. If
  756. the corruption is caused by a one time event such as a power outage,
  757. running `borg check --repair` will fix most problems.
  758. Why isn't there more progress / ETA information displayed?
  759. ----------------------------------------------------------
  760. Some borg runs take quite a bit, so it would be nice to see a progress display,
  761. maybe even including a ETA (expected time of "arrival" [here rather "completion"]).
  762. For some functionality, this can be done: if the total amount of work is more or
  763. less known, we can display progress. So check if there is a ``--progress`` option.
  764. But sometimes, the total amount is unknown (e.g. for ``borg create`` we just do
  765. a single pass over the filesystem, so we do not know the total file count or data
  766. volume before reaching the end). Adding another pass just to determine that would
  767. take additional time and could be incorrect, if the filesystem is changing.
  768. Even if the fs does not change and we knew count and size of all files, we still
  769. could not compute the ``borg create`` ETA as we do not know the amount of changed
  770. chunks, how the bandwidth of source and destination or system performance might
  771. fluctuate.
  772. You see, trying to display ETA would be futile. The borg developers prefer to
  773. rather not implement progress / ETA display than doing futile attempts.
  774. See also: https://xkcd.com/612/
  775. Why am I getting 'Operation not permitted' errors when backing up on sshfs?
  776. ---------------------------------------------------------------------------
  777. By default, ``sshfs`` is not entirely POSIX-compliant when renaming files due to
  778. a technicality in the SFTP protocol. Fortunately, it also provides a workaround_
  779. to make it behave correctly::
  780. sshfs -o workaround=rename user@host:dir /mnt/dir
  781. .. _workaround: https://unix.stackexchange.com/a/123236
  782. Can I disable checking for free disk space?
  783. -------------------------------------------
  784. In some cases, the free disk space of the target volume is reported incorrectly.
  785. This can happen for CIFS- or FUSE shares. If you are sure that your target volume
  786. will always have enough disk space, you can use the following workaround to disable
  787. checking for free disk space::
  788. borg config -- $REPO_LOCATION additional_free_space -2T
  789. Miscellaneous
  790. #############
  791. Requirements for the borg single-file binary, esp. (g)libc?
  792. -----------------------------------------------------------
  793. We try to build the binary on old, but still supported systems - to keep the
  794. minimum requirement for the (g)libc low. The (g)libc can't be bundled into
  795. the binary as it needs to fit your kernel and OS, but Python and all other
  796. required libraries will be bundled into the binary.
  797. If your system fulfills the minimum (g)libc requirement (see the README that
  798. is released with the binary), there should be no problem. If you are slightly
  799. below the required version, maybe just try. Due to the dynamic loading (or not
  800. loading) of some shared libraries, it might still work depending on what
  801. libraries are actually loaded and used.
  802. In the borg git repository, there is scripts/glibc_check.py that can determine
  803. (based on the symbols' versions they want to link to) whether a set of given
  804. (Linux) binaries works with a given glibc version.
  805. Why was Borg forked from Attic?
  806. -------------------------------
  807. Borg was created in May 2015 in response to the difficulty of getting new
  808. code or larger changes incorporated into Attic and establishing a bigger
  809. developer community / more open development.
  810. More details can be found in `ticket 217
  811. <https://github.com/jborg/attic/issues/217>`_ that led to the fork.
  812. Borg intends to be:
  813. * simple:
  814. * as simple as possible, but no simpler
  815. * do the right thing by default, but offer options
  816. * open:
  817. * welcome feature requests
  818. * accept pull requests of good quality and coding style
  819. * give feedback on PRs that can't be accepted "as is"
  820. * discuss openly, don't work in the dark
  821. * changing:
  822. * Borg is not compatible with Attic
  823. * do not break compatibility accidentally, without a good reason
  824. or without warning. allow compatibility breaking for other cases.
  825. * if major version number changes, it may have incompatible changes
  826. Migrating from Attic
  827. ####################
  828. What are the differences between Attic and Borg?
  829. ------------------------------------------------
  830. Borg is a fork of `Attic`_ and maintained by "`The Borg collective`_".
  831. .. _Attic: https://github.com/jborg/attic
  832. .. _The Borg collective: https://borgbackup.readthedocs.org/en/latest/authors.html
  833. Here's a (incomplete) list of some major changes:
  834. * lots of attic issues fixed
  835. (see `issue #5 <https://github.com/borgbackup/borg/issues/5>`_),
  836. including critical data corruption bugs and security issues.
  837. * more open, faster paced development
  838. (see `issue #1 <https://github.com/borgbackup/borg/issues/1>`_)
  839. * less chunk management overhead (less memory and disk usage for chunks index)
  840. * faster remote cache resync (useful when backing up multiple machines into same repo)
  841. * compression: no, lz4, zstd, zlib or lzma compression, adjustable compression levels
  842. * repokey replaces problematic passphrase mode (you can't change the passphrase
  843. nor the pbkdf2 iteration count in "passphrase" mode)
  844. * simple sparse file support, great for virtual machine disk files
  845. * can read special files (e.g. block devices) or from stdin, write to stdout
  846. * rename-based locking is more compatible than attic's posix locking
  847. * uses fadvise to not spoil / blow up the fs cache
  848. * better error messages / exception handling
  849. * better logging, screen output, progress indication
  850. * tested on misc. Linux systems, 32 and 64bit, FreeBSD, OpenBSD, NetBSD, macOS
  851. Please read the :ref:`changelog` (or ``docs/changes.rst`` in the source distribution) for more
  852. information.
  853. Borg is not compatible with original Attic (but there is a one-way conversion).
  854. How do I migrate from Attic to Borg?
  855. ------------------------------------
  856. Use :ref:`borg_upgrade`. This is a one-way process that cannot be reversed.
  857. There are some caveats:
  858. - The upgrade can only be performed on local repositories.
  859. It cannot be performed on remote repositories.
  860. - If the repository is in "keyfile" encryption mode, the keyfile must
  861. exist locally or it must be manually moved after performing the upgrade:
  862. 1. Get the repository ID with ``borg config /path/to/repo id``.
  863. 2. Locate the attic key file at ``~/.attic/keys/``. The correct key for the
  864. repository starts with the line ``ATTIC_KEY <repository id>``.
  865. 3. Copy the attic key file to ``~/.config/borg/keys/``
  866. 4. Change the first line from ``ATTIC_KEY ...`` to ``BORG_KEY ...``.
  867. 5. Verify that the repository is now accessible (e.g. ``borg list <repository>``).
  868. - Attic and Borg use different :ref:`"chunker params" <chunker-params>`.
  869. This means that data added by Borg won't deduplicate with the existing data
  870. stored by Attic. The effect is lessened if the files cache is used with Borg.
  871. - Repositories in "passphrase" mode *must* be migrated to "repokey" mode using
  872. :ref:`borg_key_migrate-to-repokey`. Borg does not support the "passphrase" mode
  873. any other way.
  874. Why is my backup bigger than with attic?
  875. ----------------------------------------
  876. Attic was rather unflexible when it comes to compression, it always
  877. compressed using zlib level 6 (no way to switch compression off or
  878. adjust the level or algorithm).
  879. The default in Borg is lz4, which is fast enough to not use significant CPU time
  880. in most cases, but can only achieve modest compression. It still compresses
  881. easily compressed data fairly well.
  882. Borg also offers zstd, zlib and lzma compression, choose wisely.
  883. Which choice is the best option depends on a number of factors, like
  884. bandwidth to the repository, how well the data compresses, available CPU
  885. power and so on.