Add design and user documentation for the `restic tag` command

This commit is contained in:
Pauline Middelink 2017-03-05 19:06:06 +01:00 committed by Alexander Neumann
parent 1fa2313aef
commit be15a9261a
2 changed files with 42 additions and 3 deletions

View File

@ -285,7 +285,7 @@ This way, the password can be changed without having to re-encrypt all data.
Snapshots Snapshots
--------- ---------
A snapshots represents a directory with all files and sub-directories at a A snapshot represents a directory with all files and sub-directories at a
given point in time. For each backup that is made, a new snapshot is created. A given point in time. For each backup that is made, a new snapshot is created. A
snapshot is a JSON document that is stored in an encrypted file below the snapshot is a JSON document that is stored in an encrypted file below the
directory `snapshots` in the repository. The filename is the storage ID. This directory `snapshots` in the repository. The filename is the storage ID. This
@ -304,12 +304,22 @@ enter password for repository:
"hostname": "kasimir", "hostname": "kasimir",
"username": "fd0", "username": "fd0",
"uid": 1000, "uid": 1000,
"gid": 100 "gid": 100,
"tags": [
"NL"
],
"original": "251c2e5841355f743f9d4ffd3260bee765acee40a6229857e32b60446991b837"
} }
``` ```
Here it can be seen that this snapshot represents the contents of the directory Here it can be seen that this snapshot represents the contents of the directory
`/tmp/testdata`. The most important field is `tree`. `/tmp/testdata` after its tags were changed to "NL". The most important field
is `tree`.
Another important field is `original`, if any modification is made to the
snapshot, say because its tags changed, its SHA-256 hash changes and therefore
the original snapshot id is lost. Retaining a stable id is especially important
for caching.
All content within a restic repository is referenced according to its SHA-256 All content within a restic repository is referenced according to its SHA-256
hash. Before saving, each file is split into variable sized Blobs of data. The hash. Before saving, each file is split into variable sized Blobs of data. The

View File

@ -73,6 +73,7 @@ Available Commands:
rebuild-index build a new index file rebuild-index build a new index file
restore extract the data from a snapshot restore extract the data from a snapshot
snapshots list all snapshots snapshots list all snapshots
tag modifies tags on snapshots
unlock remove locks other processes created unlock remove locks other processes created
version Print version information version Print version information
@ -394,6 +395,34 @@ enter password for repository:
*eb78040b username kasimir 2015-08-12 13:29:57 *eb78040b username kasimir 2015-08-12 13:29:57
``` ```
# Manage tags
Managing tags on snapshots is simple. The existing set of tags can be either
replaced completely, added to or removed from. The result is directly visible
in the `snapshots` command.
```console
$ restic -r /tmp/backup tag --set NL,CH 590c8fc8
Create exclusive lock for repository
Modified tags on 1 snapshots
```
Note the snapshot ID has changed, so between each change we need to look up
the new ID of the snapshot. But there is an even better way, the `tag` command
accepts `--tag`, so we can filter snapshots based on the tag we just added.
```console
$ restic -r /tmp/backup tag --tag NL --remove CH
Create exclusive lock for repository
Modified tags on 1 snapshots
$ restic -r /tmp/backup tag --tag NL --add UK
Create exclusive lock for repository
Modified tags on 1 snapshots
$ restic -r /tmp/backup tag --tag NL --remove NL
Create exclusive lock for repository
Modified tags on 1 snapshots
$ restic -r /tmp/backup tag --tag NL --add SOMETHING
No snapshots were modified
```
# Check integrity and consistency # Check integrity and consistency
Imagine your repository is saved on a server that has a faulty hard drive, or Imagine your repository is saved on a server that has a faulty hard drive, or