2022-12-29 11:08:22 -05:00
|
|
|
1. Before a backup can be made, a repository has to be initialized::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-08 10:26:52 -04:00
|
|
|
$ borg -r /path/to/repo repo-create --encryption=repokey-aes-ocb
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2022-12-28 19:01:48 -05:00
|
|
|
2. Back up the ``~/src`` and ``~/Documents`` directories into an archive called
|
2024-09-18 08:05:12 -04:00
|
|
|
*docs*::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
$ borg -r /path/to/repo create docs ~/src ~/Documents
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2025-08-23 18:21:57 -04:00
|
|
|
3. The next day, create a new archive using the same archive name::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
$ borg -r /path/to/repo create --stats docs ~/src ~/Documents
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2025-08-23 18:21:57 -04:00
|
|
|
This backup will be much quicker and much smaller, since only new,
|
|
|
|
|
never-before-seen data is stored. The ``--stats`` option causes Borg to
|
2022-06-23 19:19:19 -04:00
|
|
|
output statistics about the newly created archive such as the deduplicated
|
|
|
|
|
size (the amount of unique data not shared with other archives)::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2022-06-23 19:19:19 -04:00
|
|
|
Repository: /path/to/repo
|
2024-09-18 08:05:12 -04:00
|
|
|
Archive name: docs
|
2022-06-23 19:19:19 -04:00
|
|
|
Archive fingerprint: bcd1b53f9b4991b7afc2b339f851b7ffe3c6d030688936fe4552eccc1877718d
|
|
|
|
|
Time (start): Sat, 2022-06-25 20:21:43
|
|
|
|
|
Time (end): Sat, 2022-06-25 20:21:43
|
|
|
|
|
Duration: 0.07 seconds
|
2025-08-23 18:21:57 -04:00
|
|
|
Utilization of maximum archive size: 0%
|
2022-06-23 19:19:19 -04:00
|
|
|
Number of files: 699
|
|
|
|
|
Original size: 31.14 MB
|
|
|
|
|
Deduplicated size: 502 B
|
2017-02-05 15:32:24 -05:00
|
|
|
|
|
|
|
|
4. List all archives in the repository::
|
|
|
|
|
|
2024-09-08 10:26:52 -04:00
|
|
|
$ borg -r /path/to/repo repo-list
|
2024-09-18 08:05:12 -04:00
|
|
|
docs Sat, 2022-06-25 20:21:14 [b80e24d2...b179f298]
|
|
|
|
|
docs Sat, 2022-06-25 20:21:43 [bcd1b53f...1877718d]
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
5. List the contents of the first archive::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
$ borg -r /path/to/repo list aid:b80e24d2
|
2017-02-05 15:32:24 -05:00
|
|
|
drwxr-xr-x user group 0 Mon, 2016-02-15 18:22:30 home/user/Documents
|
|
|
|
|
-rw-r--r-- user group 7961 Mon, 2016-02-15 18:22:30 home/user/Documents/Important.doc
|
|
|
|
|
...
|
|
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
6. Restore the first archive by extracting the files relative to the current directory::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
$ borg -r /path/to/repo extract aid:b80e24d2
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2025-09-04 14:29:43 -04:00
|
|
|
7. Delete the first archive (please note that this does **not** free repository disk space)::
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
$ borg -r /path/to/repo delete aid:b80e24d2
|
2022-06-23 19:19:19 -04:00
|
|
|
|
2025-08-23 18:21:57 -04:00
|
|
|
Be careful if you use an archive NAME (and not an archive ID), as it might match multiple archives.
|
|
|
|
|
Always use ``--dry-run`` and ``--list`` first!
|
2017-02-05 15:32:24 -05:00
|
|
|
|
2025-08-23 18:21:57 -04:00
|
|
|
8. Recover disk space by compacting the segment files in the repository::
|
2022-02-19 13:25:16 -05:00
|
|
|
|
2024-09-18 08:05:12 -04:00
|
|
|
$ borg -r /path/to/repo compact -v
|
2022-02-19 13:25:16 -05:00
|
|
|
|
2017-02-05 15:32:24 -05:00
|
|
|
.. Note::
|
2022-12-29 11:08:22 -05:00
|
|
|
Borg is quiet by default (it defaults to WARNING log level).
|
2017-02-05 15:32:24 -05:00
|
|
|
You can use options like ``--progress`` or ``--list`` to get specific
|
|
|
|
|
reports during command execution. You can also add the ``-v`` (or
|
|
|
|
|
``--verbose`` or ``--info``) option to adjust the log level to INFO to
|
|
|
|
|
get other informational messages.
|