From 64d27eed868812dfab1b9842c95db943ebf71951 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 14 Jul 2018 20:45:52 +0200 Subject: [PATCH] doc: Improve dump to stdout Closes #1884 --- doc/050_restore.rst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/050_restore.rst b/doc/050_restore.rst index f21c002cb..f2a2f1273 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -85,3 +85,36 @@ the data directly. This can be achieved by using the `dump` command, like this: .. code-block:: console $ restic -r /srv/restic-repo dump latest production.sql | mysql + +If you have saved multiple different things into the same repo, the ``latest`` +snapshot may not be the right one. For example, consider the following +snapshots in a repo: + +.. code-block:: console + + $ restic -r /srv/restic-repo snapshots + ID Date Host Tags Directory + ---------------------------------------------------------------------- + 562bfc5e 2018-07-14 20:18:01 mopped /home/user/file1 + bbacb625 2018-07-14 20:18:07 mopped /home/other/work + e922c858 2018-07-14 20:18:10 mopped /home/other/work + 098db9d5 2018-07-14 20:18:13 mopped /production.sql + b62f46ec 2018-07-14 20:18:16 mopped /home/user/file1 + 1541acae 2018-07-14 20:18:18 mopped /home/other/work + ---------------------------------------------------------------------- + +Here, restic would resolve ``latest`` to the snapshot ``1541acae``, which does +not contain the file we'd like to print at all (``production.sql``). In this +case, you can pass restic the snapshot ID of the snapshot you like to restore: + +.. code-block:: console + + $ restic -r /srv/restic-repo dump 098db9d5 production.sql | mysql + +Or you can pass restic a path that should be used for selecting the latest +snapshot. The path must match the patch printed in the "Directory" column, +e.g.: + +.. code-block:: console + + $ restic -r /srv/restic-repo dump --path /production.sql latest production.sql | mysql