Once the repo is mounted, I can see the following dirs:
.
├── hosts
├── ids
├── snapshots
└── tags
Using the folders, I can get any data conveniently navigating by any of the fields. For simplicity, anyway, I’d like to mount just a single snapshot. Is that possible? I’ve been checking the documentation with no luck.
I’m writing a script to simplify/automate restoring process. The idea is to show the output of restic “snapshots”, then the user types the id of one of the snapshots and the restore process starts mounting the snapshot and using rsync to avoid re-writing un-needed files in the destination directory.
It’s perfectly possible with the current behaviour, but I thought it could be cleaner and simpler if only the needed snapshot was mounted.
I guess there are no benefits in mounting only some snapshots. A mount does not mean that all the files are there on disk like it looks to the user. It just means you have access to them if you ask for them (in non-technical terms). So only when you open or copy a file, it needs to be decrypted and reassembled.
Using rsync on a mounted snapshot is a bad idea in general and a very bad idea with remote repositories - every read access of rsync needs a potentially expensive read access to the repository, the implemented caching only helps in special situations.
TL;DR: use the restore command which (in newest restic versions) also avoids re-writing unneeded files in the destination. It is also much faster than your solution, optimized the access to the repository and already supports using a specific snapshot.
@noeck It might be easier for users to navigate (especially if you can mount latest), and technically there is a bit less internal overhead, but I agree that the benefit is small.
FWIW, if you need/want such a functionality have a look at https://forum.restic.net/t/a-restic-client-written-in-rust/
I’ll check next time. I’ve recently did a large restore (not sure about the version of restic) and many if not all the files were rewritten although it could have happened because differences with ownership or permissions.
You should try it with the latest version of restic. There’s code in restic that is meant to only update the parts of files that have changed. EDIT: What Alex wrote above, the --overwrite option.