faq.rst 55 KB

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