From 2c37fb27ad2c24a2d134dd399f467234da600b53 Mon Sep 17 00:00:00 2001 From: Markus Kramer Date: Wed, 9 Aug 2023 10:59:56 +0200 Subject: [PATCH 1/3] dump requires absolute path from within the repo --- doc/050_restore.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/050_restore.rst b/doc/050_restore.rst index ed2ddfd40..6978acb91 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -156,6 +156,24 @@ e.g.: $ restic -r /srv/restic-repo dump --path /production.sql latest production.sql | mysql +For a local repository, the "Directory" path can result in the error message ``cannot dump file: path "/home" not found in snapshot`` +In this case, you can query the absolute path within the repository using the ```ls`` command: + +.. code-block:: console + + $ restic -r /srv/restic-repo ls latest / + enter password for repository: + snapshot 1541acae of [/home/other/work] filtered by [/] at 2023-08-09 04:00:03.533117139 +0200 CEST): + /work + + +and use the latter absolute path for the ``dump`` command: + +.. code-block:: console + + $ restic -r /srv/restic-repo dump latest /work/README.md + + It is also possible to ``dump`` the contents of a whole folder structure to stdout. To retain the information about the files and folders Restic will output the contents in the tar (default) or zip format: From d57ef6ec75362138208bcc27d94a83605ccb8adc Mon Sep 17 00:00:00 2001 From: Markus Kramer Date: Wed, 16 Aug 2023 12:48:22 +0200 Subject: [PATCH 2/3] Added path discrepancy to backup and listing --- doc/040_backup.rst | 11 +++++++++++ doc/045_working_with_repos.rst | 3 +++ doc/050_restore.rst | 23 +++++++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/doc/040_backup.rst b/doc/040_backup.rst index 1655e7eed..12a617665 100644 --- a/doc/040_backup.rst +++ b/doc/040_backup.rst @@ -45,6 +45,17 @@ size of the files and directories in ``~/work`` on the local file system. It also tells us that only 1.200 GiB was added to the repository. This means that some of the data was duplicate and restic was able to efficiently reduce it. +We just attached the absolute path ``~/work`` to the backup, so the path +within the repository is ``/home/user/work``, depending on your user name. + +If we attach a relative path ``work``, the path within the repository is ``/work``. + +For example ``restic backup work`` run from ``/home/user`` crates a snapshot +with a attached path ``/home/user/work`` that contains the path ``/work`` +within the repository. This path-related discrepancy applies to each command +that tries to access data within a snapshot. You can lookup the paths within +a repository using the ``ls latest /`` command. + If you don't pass the ``--verbose`` option, restic will print less data. You'll still get a nice live status display. Be aware that the live status shows the processed files and not the transferred data. Transferred volume might be lower diff --git a/doc/045_working_with_repos.rst b/doc/045_working_with_repos.rst index 82a20bac4..da599cc5f 100644 --- a/doc/045_working_with_repos.rst +++ b/doc/045_working_with_repos.rst @@ -32,6 +32,9 @@ Now, you can list all the snapshots stored in the repository: 590c8fc8 2015-05-08 21:47:38 kazik /srv 9f0bc19e 2015-05-08 21:46:11 luigi /srv +The Directory column shows the attached path, which may differ +from the path within the repository, see https://restic.readthedocs.io/en/stable/040_backup.html#backing-up for details of this discrepancy. + You can filter the listing by directory path: .. code-block:: console diff --git a/doc/050_restore.rst b/doc/050_restore.rst index 6978acb91..d87df4f1d 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -156,8 +156,21 @@ e.g.: $ restic -r /srv/restic-repo dump --path /production.sql latest production.sql | mysql -For a local repository, the "Directory" path can result in the error message ``cannot dump file: path "/home" not found in snapshot`` -In this case, you can query the absolute path within the repository using the ```ls`` command: +This example assumes you attached an absolute path, which means it coincides with the +path within the repository. +See https://restic.readthedocs.io/en/stable/040_backup.html#backing-up for the difference +between attached path and path within the repository. + +If you attached a relative path, the ``dump`` command would look like: + +.. code-block:: console + + $ restic -r /srv/restic-repo dump latest /work/README.md + + +If dump results in the error message ``cannot dump file: path "/home" not found in snapshot`` +first double check you used the path within the repository, using the ``ls latest /`` command, +which for the repository above results in: .. code-block:: console @@ -167,12 +180,6 @@ In this case, you can query the absolute path within the repository using the `` /work -and use the latter absolute path for the ``dump`` command: - -.. code-block:: console - - $ restic -r /srv/restic-repo dump latest /work/README.md - It is also possible to ``dump`` the contents of a whole folder structure to stdout. To retain the information about the files and folders Restic will From 1925457b7884afb2fd1d65bb071b4261b7e838bd Mon Sep 17 00:00:00 2001 From: Markus Kramer Date: Sun, 20 Aug 2023 17:20:46 +0200 Subject: [PATCH 3/3] Entered feedback from MichaelEischer --- doc/040_backup.rst | 10 +++++----- doc/050_restore.rst | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/040_backup.rst b/doc/040_backup.rst index 12a617665..079f013bf 100644 --- a/doc/040_backup.rst +++ b/doc/040_backup.rst @@ -46,13 +46,13 @@ also tells us that only 1.200 GiB was added to the repository. This means that some of the data was duplicate and restic was able to efficiently reduce it. We just attached the absolute path ``~/work`` to the backup, so the path -within the repository is ``/home/user/work``, depending on your user name. +within the snapshot is ``/home/user/work``. -If we attach a relative path ``work``, the path within the repository is ``/work``. +If we attach a relative path ``work``, the path within the snaphot is ``/work``. -For example ``restic backup work`` run from ``/home/user`` crates a snapshot -with a attached path ``/home/user/work`` that contains the path ``/work`` -within the repository. This path-related discrepancy applies to each command +For example ``restic backup work`` run from ``/home/user`` creates a snapshot +with a directory ``/home/user/work`` that contains the path ``/work`` +within the snapshot. This path-related discrepancy applies to each command that tries to access data within a snapshot. You can lookup the paths within a repository using the ``ls latest /`` command. diff --git a/doc/050_restore.rst b/doc/050_restore.rst index d87df4f1d..a838c95d5 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -156,12 +156,12 @@ e.g.: $ restic -r /srv/restic-repo dump --path /production.sql latest production.sql | mysql -This example assumes you attached an absolute path, which means it coincides with the -path within the repository. +This example assumes you ran a backup using an absolute path, which coincides with the +path within the snaphots. See https://restic.readthedocs.io/en/stable/040_backup.html#backing-up for the difference -between attached path and path within the repository. +between the path used to create the repository and the paths within the snaphots. -If you attached a relative path, the ``dump`` command would look like: +If you ran a backup using the relative path ``work/``, the ``dump`` command would look like: .. code-block:: console @@ -169,7 +169,7 @@ If you attached a relative path, the ``dump`` command would look like: If dump results in the error message ``cannot dump file: path "/home" not found in snapshot`` -first double check you used the path within the repository, using the ``ls latest /`` command, +first double check you used the path within the snaphot, using the ``ls latest /`` command, which for the repository above results in: .. code-block:: console