quickstart_example.rst.inc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 1. Before a backup can be made, a repository has to be initialized::
  2. $ borg -r /path/to/repo repo-create --encryption=repokey-aes-ocb
  3. 2. Back up the ``~/src`` and ``~/Documents`` directories into an archive called
  4. *Monday*::
  5. $ borg -r /path/to/repo create Monday ~/src ~/Documents
  6. 3. The next day create a new archive called *Tuesday*::
  7. $ borg -r /path/to/repo create --stats Tuesday ~/src ~/Documents
  8. This backup will be a lot quicker and a lot smaller since only new, never
  9. before seen data is stored. The ``--stats`` option causes Borg to
  10. output statistics about the newly created archive such as the deduplicated
  11. size (the amount of unique data not shared with other archives)::
  12. Repository: /path/to/repo
  13. Archive name: Tuesday
  14. Archive fingerprint: bcd1b53f9b4991b7afc2b339f851b7ffe3c6d030688936fe4552eccc1877718d
  15. Time (start): Sat, 2022-06-25 20:21:43
  16. Time (end): Sat, 2022-06-25 20:21:43
  17. Duration: 0.07 seconds
  18. Utilization of max. archive size: 0%
  19. Number of files: 699
  20. Original size: 31.14 MB
  21. Deduplicated size: 502 B
  22. 4. List all archives in the repository::
  23. $ borg -r /path/to/repo repo-list
  24. Monday Sat, 2022-06-25 20:21:14 [b80e24d2...b179f298]
  25. Tuesday Sat, 2022-06-25 20:21:43 [bcd1b53f...1877718d]
  26. 5. List the contents of the *Monday* archive::
  27. $ borg -r /path/to/repo list Monday
  28. drwxr-xr-x user group 0 Mon, 2016-02-15 18:22:30 home/user/Documents
  29. -rw-r--r-- user group 7961 Mon, 2016-02-15 18:22:30 home/user/Documents/Important.doc
  30. ...
  31. 6. Restore the *Monday* archive by extracting the files relative to the current directory::
  32. $ borg -r /path/to/repo extract Monday
  33. 7. Delete the *Monday* archive (please note that this does **not** free repo disk space)::
  34. $ borg -r /path/to/repo delete -a Monday
  35. Please note the ``-a`` option here (short for ``--match-archives``) which enables you
  36. to give a pattern to delete multiple archives, like ``-a 'sh:oldcrap-*'``.
  37. You can also combine this with ``--first``, ``--last`` and ``--sort-by``.
  38. Be careful, always first use with ``--dry-run`` and ``--list``!
  39. 8. Recover disk space by compacting the segment files in the repo::
  40. $ borg -r /path/to/repo compact
  41. .. Note::
  42. Borg is quiet by default (it defaults to WARNING log level).
  43. You can use options like ``--progress`` or ``--list`` to get specific
  44. reports during command execution. You can also add the ``-v`` (or
  45. ``--verbose`` or ``--info``) option to adjust the log level to INFO to
  46. get other informational messages.