How to: Inspect Snapshot?

I want to look in a snapshot at

run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/snapshots

How do I achieve this?

I am trying

restic list -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/snapshots/ 0c93b8a519735e9ee4bff01c66c5eb89a582e28c9368ed2e56dcc283ccd18864
Fatal: unable to open config file: Stat: stat /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/snapshots/config: no such file or directory
Is there a repository at the following location?
/run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/snapshots/

Yeah bro there is a repo there. That is where all the snapshots are stored. Not sure what syntax I’m missing.

The path /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/snapshots/ 0c93b8a519735e9ee4bff01c66c5eb89a582e28c9368ed2e56dcc283ccd18864 is a path to a snapshot file, rather than a path to a repository. So no, there’s no repository at that path.

If you want to reference the path to the repository (which is what you’d do with the -r option), you should use the path /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet - that’s where your repository lives.

What is it you want to look at? If you want to see what files that were/are backed up in a snapshot, you can use restic ls, see restic help ls for more information :+1: You can also use restic find to search for files in snapshots.

2 Likes

I can see all the snapshots with:
“sudo restic -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ snapshots”

I see snapshot 0e88542b that have /var/www I need to restore.

First I want to inspect this directory. I am trying:
“sudo restic -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ snapshots --path=“0e88542b/var/www”” and get "enter password for repository:
repository e72f1d68 opened successfully, password is correct
"

looks like trying to open a different snapshot e72f1d68, was expecting an output. What don’t I see?

What do you mean by “inspect this directory”? I presume you want to see what is stored in/for that directory, in that specific snapshot?

If so, the command would be like this sudo restic -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ ls 0e88542b /var/www. This will list the contents of that snapshot, but only the parts of it which is the /var/www directory and whatever is inside and under it. If you want to list everything in the snapshot, remove the /var/www part from the command.

You should really check out the help for the commands by running restic help and restic help ls (and any other command using restic help <command>). Don’t forget restic help restore :slight_smile:

1 Like

Thanks I’m using manuals and documentation. It’s the syntax that is catching me up still. use the “–path” or “–target”

How does this look?
sudo restic -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ snapshots latest /var/www --target /mnt/varJESSE

first time restore from backup =)

My guess is what you’re after is restic mount which will let you inspect the contents of any snapshot, and well as extract individual files. It mounts the remote repo and a local filesystem, and each snapshot is mapped to a directory within the filesystem.

https://restic.readthedocs.io/en/v0.3.2/Manual/?q=mount&check_keywords=yes&area=default#mount-a-repository

1 Like

Different things, read the documentation :wink:

There’s no --target option to the snapshots command, and the snapshots command doesn’t have anything to do with actually restoring the data. Run restic help and see if you can find a command that has to do with restoring data, then run restic help <that command> to see how to use it :wink:

You’re getting there, very close now! :+1:

1 Like

Awesome thanks for the guidance it helped. I got here. I got something wrong with the path some how. I am trying to restore /var directory

[liveuser@localhost-live ~]$ sudo restic restore -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ latest --path /var/ --target /mnt/varJESSE
enter password for repository:
repository e72f1d68 opened successfully, password is correct
latest snapshot for criteria not found: no snapshot found Paths:[/var/] Hosts:[]

Isn’t it --include you want to use?

Sweet,
sudo restic restore -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ latest --include="/var/" --target /mnt/varJESSE

the word “casing” threw me off in the manual. Merci Beacoup

Looks like it should work, although you do have the order of the arguments wrong. If you read restic help restore you will see that the syntax is restic restore [flags] snapshotID, and since the -r is a global flag it should come before the restore command, and the snapshot ID should be the last part.

This is what the manual says == do it that way. I’m not sure why everyone and their cat puts the options at the end all the fricken time (I see this pretty much all the time), when the help text so clearly shows what the proper syntax is.

So it should be sudo restic -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ restore --include="/var/" --target /mnt/varJESSE latest

3 Likes
[root@orcacomputers snapshots]# restic -r /run/media/Neptune/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ mount /mnt/3d299e46 
enter password for repository: 
repository e72f1d68 opened successfully, password is correct
Now serving the repository at /mnt/3d299e46
When finished, quit with Ctrl-c or umount the mountpoint.

Trying to mount and inspect. The command goes through and brings me to a blinking cursor that is not the terminal ci.
I want to get in that directory and sniff around

That’s doing what it should. Now, while leaving that command running just as it is, open another terminal and go look in /mnt/3d299e46. When finished sniffing around, go back to the first terminal and, as it says, hit Ctrl-c.

2 Likes

I opened mount: Improve usage information when mounted by rawtaz · Pull Request #3562 · restic/restic · GitHub to make the message there even more helpful.

1 Like

sudo restic -r /run/media/Neptune/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet mount /mnt/JESSE3d299e46 3d299e46

so I cd /mnt/JESSE3d299e46 and see directories of hosts, ids, snapshots, tags. I was expecting to see directory
3d299e46 2021-10-30 16:52:29 localhost-live /dev/mapper/nvmeVg-home

when I cd snapshots I see more snapshots in /mnt/JESSE3d299e46/snapshots. I was not expecting these to be here.

Objective is to be able to peruse /dev/mapper/nvmeVg-home I can list /dev/mapper/nvmeVg-home but I want to see what is inside /dev/mapper/nvmeVg-home

This is what I currently have


restic -r /srv/dev ls --recursive --path /dev/mapper/nvmeVg-home snapshot

Honestly, you need to align your expectations with reality. What you see in that folder is what restic was built to present, and even if it doesn’t match what you expected, this isn’t an issue. If you simply look at what you’re seeing you will understand that you are seeing subfolders that lets you browse your backups in different ways, e.g. by snapshot, by hostname, by tags, etc. This is a useful feature, and not a problem.

I’m not sure why you think you should supply a snapshot ID at the end of your mount command - there’s nothing about that in restic help mount which says that restic mount [flags] mountpoint is the syntax. The reason is simple; The mount command mounts the entire repository at the path (mountpoint) you provide, such that you can then start browsing it. It isn’t concerned with an individual snapshot.

So if you want to “get into” the snapshot with id 3d299e46 you simply go into the snapshots/ folder and in there you find the 3d299e46 folder (or the folder starting with those characters in its name), and in there you should find the actual files in that snapshot. I believe this is what you’re searching for.

There’s no harm looking around to see what you find, even if it’s not what you expected to see.

Does this make sense? Can you in the path that I presume will be /mnt/JESSE3d299e46/snapshots/3d299e46 see the paths that you backed up? If not, please run ls -la /mnt/JESSE3d299e46/snapshots/3d299e46 and show us the output :slight_smile:

1 Like

curious how come latest isnt in the docs? latest rocks!

Back at it. So I am in /snapshots. I see them all but they are not searchable directories. I am trying to audit apache configuration file /etc/httpd/conf/

My command is going through but not expecting the desired result which is to list the contents of /etc/httpd/conf/ on the snapshot. I tried --include

[root@orcacomputers snapshots]# sudo restic -r /run/media/Neptune/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ snapshots 8465cc2b --path="/etc/httpd/conf/"
enter password for repository: 
repository e72f1d68 opened successfully, password is correct
Ignoring filters as there are explicit snapshot ids given
ID        Time                 Host            Tags        Paths
----------------------------------------------------------------------------------
8465cc2b  2021-10-30 16:55:56  localhost-live              /dev/mapper/nvmeVg-root
----------------------------------------------------------------------------------
1 snapshots
[root@orcacomputers snapshots]#

What is wrong with this? Sequence is off

sudo restic -r /run/media/Neptune/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet snapshots 8465cc2b mount="/run/media/TEMPAPACHE"
enter password for repository: 
repository e72f1d68 opened successfully, password is correct
Ignoring "mount=/run/media/TEMPAPACHE", it is not a snapshot id

What do you mean? The latest stable release documentation is at Restic Documentation — restic 0.12.1 documentation and the latest master (unreleased) documentation is at Restic Documentation — restic 0.12.1 documentation .

Not sure what you mean by this. You can just use a terminal or a file browser to navigate into those directories (under /mnt/JESSE3d299e46/snapshots/ when you have the repository mounted), to find, look at, open and/or restore the files. What could possibly be stopping you from doing this?

I have no idea why you are trying that command. I have been showing you how to use the commands earlier in this thread, and I have also shown you how to use the built-in restic help command to see the exact syntax that is available for the commands you are trying to use.

The command you showed here (restic -r /run/media/Neptune/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ snapshots 8465cc2b --path="/etc/httpd/conf/") is not in any way meant to list the contents of a file in the /etc/httpd/conf/ directory inside that snapshot. The snapshot command lists snapshots, it doesn’t list files in snapshots. Nor are you using --include which you say you are (which is good, because there is no --include option to the snapshots command).

Again, you are for some reason running a command that is completely incorrect. What makes you think that the snapshots command takes an option/argument/parameter that is named mount? Have you even looked at the help from restic help snapshots, where you would see that there is no such option for the snapshots command?


Here’s the elephant in the room;

  • You are completely mistaken in your attempts at trying to use even the simplest commands in restic.
  • I have repeatedly showed you how to use the commands, exactly what to write, showed you exactly how to use the restic help and restic help <command> to see what commands there is that you can use, what the syntax for the commands is, what options they have, and so on.
  • We also finally reached the point where you did have the repository mounted in /mnt/JESSE3d299e46/snapshots/3d299e46, at which point all you had to do was to go into that path/directory and then browse further into the directories and files that you backed up in that snapshot (3d299e46).
  • If you want to get to the files in another snapshot, you simply (while still having the repository mounted) go into that snapshot’s directory, e.g. /mnt/JESSE3d299e46/snapshots/8465cc2b/ and browse on into e.g. /mnt/JESSE3d299e46/snapshots/8465cc2b/etc/httpd/conf/, where you will find the Apache configuration file you were looking for (that is of course assuming that this file was actually backed up in that snapshot).

Given that I have showed you every possible pointer I can to help you understand how to write the correct restic commands (which, to be fair, are not very complex at all), and also showed and told you exactly how to write the commands you needed for your specific use case, and also considering that you have a mounted repository where you are able to access the files you are looking for, I’m not sure what else anyone could possibly do here.

You simply need to 1) read the documentation I have been pointing you to several times; 2) make sure that you understand what the documentation is telling you; 3) use the right command for what you want to do (e.g. mount to mount the repository, and then simply use terminal or file browser to go into the mounted directories); 4) use the correct syntax for the chosen command (again, see restic help <command>); 5) if there’s any part of the documentation or help text you don’t understand, ask about that, because a) perhaps we need to improve those parts of the help, and b) it’s way more constructive and long-term valuable to make sure that you are able to understand documentation, than it is for you to know what you need to type “just this time”.

Since you have a working mount, there’s really no reason for you to fiddle with the restore command - instead just navigate into the mounted directories as I have been showing you earlier, and copy the files you want from there into whatever other folder on your hard drive that you want to restore the files to (outside of /mnt/JESSE3d299e46/, of course).

If this doesn’t help, I honestly think that you need someone to help you on a more professional basis. You have everything working to restore your files, if you then don’t succeed in restoring the files, you really need more hands-on help.

I wish you the best of luck.

3 Likes