[Restic](https://restic.readthedocs.io/en/latest/) jest programem do wykonywania kopii zapasowej na lokalnym dysku lub zdalnym zasobie np. [Backblaze B2](https://www.backblaze.com/b2/cloud-storage.html). Kopia zapasowa jest szyfrowana za pomocą klucza z hasłem.

Przygotowanie nowego repozytorium

Utworzenie repozytorium w katalogu /opt/restic-repo

restic init --repo /opt/restic-repo

enter password for new repository:
enter password again:
created restic repository 4c5e0dc100 at /opt/restic-repo

Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.

Wykonanie kopii zapasowej

Wykonanie kopii zapasowej katalogu ~/work w repozytorium /opt/restic-repo

restic -r /opt/restic-repo --verbose backup ~/skrypty

open repository
enter password for repository:
repository 4c5e0dc1 opened successfully, password is correct
created new cache in /home/user/.cache/restic
lock repository
load index files
start scan on [/home/user/skrypty]
start backup on [/home/user/skrypty]
scan finished in 0.377s: 1472 files, 5.572 GiB

Files:        1472 new,     0 changed,     0 unmodified
Dirs:            2 new,     0 changed,     0 unmodified
Data Blobs:   1590 new
Tree Blobs:      3 new
Added to the repo: 605.453 MiB

processed 1472 files, 5.572 GiB in 0:07
snapshot ecd12e27 saved

Lista kopii zapasowych

restic -r /opt/restic-repo snapshots

enter password for repository:
repository 4c5e0dc1 opened successfully, password is correct
ID        Time                 Host        Tags        Paths
-------------------------------------------------------------------------
ecd12e27  2019-05-01 21:28:47  x230.lan                /home/user/skrypty
ea90a14b  2019-05-01 21:31:08  x230.lan                /home/user/skrypty
d3162c73  2019-05-01 21:33:19  x230.lan                /home/user/bin
-------------------------------------------------------------------------
3 snapshots

Lista kopii zapasowych wybranego katalogu

restic -r /opt/restic-repo snapshots --path="/home/user/bin"

enter password for repository:
repository 4c5e0dc1 opened successfully, password is correct
ID        Time                 Host        Tags        Paths
---------------------------------------------------------------------
d3162c73  2019-05-01 21:33:19  x230.lan                /home/user/bin
---------------------------------------------------------------------
1 snapshots

Przywrócenie plików z kopii zapaswoej

Przywrócenie wybranej kopii zapasowej do katalogu /tmp/restore-work

restic -r /opt/restic-repo restore 79766175 --target /tmp/restore-work

Przywrócenie ostatniej kopii zapasowej

restic -r /srv/restic-repo restore latest --target /tmp/restore-art --path "/home/art"

Date: 2020-10-22T01:39:58+02:00