2017-09-30 20:01:19 +00:00
|
|
|
|
..
|
|
|
|
|
Normally, there are no heading levels assigned to certain characters as the structure is
|
|
|
|
|
determined from the succession of headings. However, this convention is used in Python’s
|
|
|
|
|
Style Guide for documenting which you may follow:
|
|
|
|
|
|
|
|
|
|
# with overline, for parts
|
|
|
|
|
* for chapters
|
|
|
|
|
= for sections
|
|
|
|
|
- for subsections
|
|
|
|
|
^ for subsubsections
|
|
|
|
|
" for paragraphs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
Working with repositories
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
|
|
Listing all snapshots
|
|
|
|
|
=====================
|
|
|
|
|
|
|
|
|
|
Now, you can list all the snapshots stored in the repository:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo snapshots
|
2017-09-30 20:01:19 +00:00
|
|
|
|
enter password for repository:
|
|
|
|
|
ID Date Host Tags Directory
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
40dc1520 2015-05-08 21:38:30 kasimir /home/user/work
|
|
|
|
|
79766175 2015-05-08 21:40:19 kasimir /home/user/work
|
|
|
|
|
bdbd3439 2015-05-08 21:45:17 luigi /home/art
|
|
|
|
|
590c8fc8 2015-05-08 21:47:38 kazik /srv
|
|
|
|
|
9f0bc19e 2015-05-08 21:46:11 luigi /srv
|
|
|
|
|
|
|
|
|
|
You can filter the listing by directory path:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo snapshots --path="/srv"
|
2017-09-30 20:01:19 +00:00
|
|
|
|
enter password for repository:
|
|
|
|
|
ID Date Host Tags Directory
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
590c8fc8 2015-05-08 21:47:38 kazik /srv
|
|
|
|
|
9f0bc19e 2015-05-08 21:46:11 luigi /srv
|
|
|
|
|
|
|
|
|
|
Or filter by host:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo snapshots --host luigi
|
2017-09-30 20:01:19 +00:00
|
|
|
|
enter password for repository:
|
|
|
|
|
ID Date Host Tags Directory
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
bdbd3439 2015-05-08 21:45:17 luigi /home/art
|
|
|
|
|
9f0bc19e 2015-05-08 21:46:11 luigi /srv
|
|
|
|
|
|
|
|
|
|
Combining filters is also possible.
|
|
|
|
|
|
2019-01-04 18:39:13 +00:00
|
|
|
|
Furthermore you can group the output by the same filters (host, paths, tags):
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ restic -r /srv/restic-repo snapshots --group-by host
|
|
|
|
|
|
|
|
|
|
enter password for repository:
|
|
|
|
|
snapshots for (host [kasimir])
|
|
|
|
|
ID Date Host Tags Directory
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
40dc1520 2015-05-08 21:38:30 kasimir /home/user/work
|
|
|
|
|
79766175 2015-05-08 21:40:19 kasimir /home/user/work
|
|
|
|
|
2 snapshots
|
|
|
|
|
snapshots for (host [luigi])
|
|
|
|
|
ID Date Host Tags Directory
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
bdbd3439 2015-05-08 21:45:17 luigi /home/art
|
|
|
|
|
9f0bc19e 2015-05-08 21:46:11 luigi /srv
|
|
|
|
|
2 snapshots
|
|
|
|
|
snapshots for (host [kazik])
|
|
|
|
|
ID Date Host Tags Directory
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
590c8fc8 2015-05-08 21:47:38 kazik /srv
|
|
|
|
|
1 snapshots
|
|
|
|
|
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
|
|
Checking a repo's integrity and consistency
|
|
|
|
|
===========================================
|
|
|
|
|
|
|
|
|
|
Imagine your repository is saved on a server that has a faulty hard
|
|
|
|
|
drive, or even worse, attackers get privileged access and modify your
|
|
|
|
|
backup with the intention to make you restore malicious data:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-12-09 16:43:50 +00:00
|
|
|
|
$ echo "boom" >> backup/index/d795ffa99a8ab8f8e42cec1f814df4e48b8f49129360fb57613df93739faee97
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
|
|
In order to detect these things, it is a good idea to regularly use the
|
|
|
|
|
``check`` command to test whether everything is alright, your precious
|
|
|
|
|
backup data is consistent and the integrity is unharmed:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo check
|
2017-09-30 20:01:19 +00:00
|
|
|
|
Load indexes
|
|
|
|
|
ciphertext verification failed
|
|
|
|
|
|
|
|
|
|
Trying to restore a snapshot which has been modified as shown above will
|
|
|
|
|
yield the same error:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo restore 79766175 --target /tmp/restore-work
|
2017-09-30 20:01:19 +00:00
|
|
|
|
Load indexes
|
|
|
|
|
ciphertext verification failed
|
|
|
|
|
|
2018-01-02 05:38:14 +00:00
|
|
|
|
By default, ``check`` command does not check that repository data files
|
|
|
|
|
are unmodified. Use ``--read-data`` parameter to check all repository
|
|
|
|
|
data files:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo check --read-data
|
2018-01-02 05:38:14 +00:00
|
|
|
|
load indexes
|
|
|
|
|
check all packs
|
|
|
|
|
check snapshots, trees and blobs
|
|
|
|
|
read all data
|
|
|
|
|
|
2019-11-18 23:43:41 +00:00
|
|
|
|
Use the ``--read-data-subset=n/t`` parameter to check only a subset of the
|
|
|
|
|
repository data files at a time. The parameter takes two values, ``n`` and
|
|
|
|
|
``t``. When the check command runs, all data files in the repository are
|
|
|
|
|
logically divided in ``t`` (roughly equal) groups, and only files that
|
|
|
|
|
belong to the group number ``n`` are checked. For example, the following
|
2018-01-02 05:38:14 +00:00
|
|
|
|
commands check all repository data files over 5 separate invocations:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
|
$ restic -r /srv/restic-repo check --read-data-subset=1/5
|
|
|
|
|
$ restic -r /srv/restic-repo check --read-data-subset=2/5
|
|
|
|
|
$ restic -r /srv/restic-repo check --read-data-subset=3/5
|
|
|
|
|
$ restic -r /srv/restic-repo check --read-data-subset=4/5
|
|
|
|
|
$ restic -r /srv/restic-repo check --read-data-subset=5/5
|
2018-01-02 05:38:14 +00:00
|
|
|
|
|