Restore (single file) and mount

Been backing up a few machines via restic for a little while. And had played with a mount previously.

But today I made a change to a file, and then thought, actually I want that back…So started trying a restore. And not having much luck.
So here’s my file’

 $ drestic.sh ls latest --path "/source" --host Melkor    /source/docker-data/hass/homeassistant/querydb.sh
repository 8f1e59ba opened successfully, password is correct
snapshot 89ad7799 of [/source] filtered by [/source/docker-data/hass/homeassistant/querydb.sh] at 2022-04-10 21:50:01.632732896 +1200 NZST):
/source/docker-data/hass/homeassistant/querydb.sh

And attempting to restore with:

drestic.sh restore  latest --path "/source" --host Melkor  --include=/source/docker-data/hass/homeassistant/querydb.sh --target /home/david/restor

Looks promising:

repository 8f1e59ba opened successfully, password is correct
restoring <Snapshot 89ad7799 of [/source] at 2022-04-10 21:50:01.632732896 +1200 NZST by root@Melkor> to /home/david/restor

Until you look in /home/david/restor which is empty…
Even taking out the specific filename and letting the whole directory restore, the directory is empty.

So I thought then, I’d try a mount, I’ve done this before.

drestic.sh mount /mnt/restic
repository 8f1e59ba opened successfully, password is correct
Mountpoint /mnt/restic doesn't exist
stat /mnt/restic: no such file or directory

But /mnt/restic does exist, and I own it.
Now my repository is on another machine, it’s not tryign to do all this on the host machine is it? I did have a look and there’s no /home/david/restic folder and no /mnt/restic on the host. But I assumed it would do all file operations on the machine making the call.

The call is a script that just executes a my restic docker container, and lets me pass in any commands, which will already know the repository location and password etc.

docker exec -it restic-backup restic $*

Is that directory mounted within the docker container? From the commands you’ve provided there is no indication for that. So probably your data is restored within the container.

restic runs all file operations in the context it is called. If you call it from within a docker container, then all operations happen within that container. By default mountpoints do not propagate between host and container.

Oh right, yes, and as soon as you point that out its now obvious. #facepalm

When I was first running restic, i had the command loaded on the machine, but then converted it to using a container.

1 Like