Restic mount on OSX (and Windows) in 2021

I love restic because is cross-platform, no-frills and runs on Windows without administrative installs or privileges. I use it on macOS and Windows.
I got in trouble when I realized that mount support is “gone” in Big Sur (and Monterey as well) so after quite a research I found that rclone (tested ver: 1.56.2) now has mount support in Big Sur (using macFuse as backend, tested ver: 4.2.1 with Big Sur 11.6.1) and in Windows 10 (using WinFSP as backend, tested ver: 1.9.21096 with Windows 10 x86 21H1 build 19043.1288)
So, if you want to use mount on macOS or Windows, putting things together you’ll have to:

  • get latest restic version (0.12.1 at time of writing)
  • get latest rclone version (1.56.2 atow) for your platform
  • install FUSE drivers (macFUSE or WinFSP) for your platform
  • configure rclone so you can access to your restic repository
  • mount restic repository via rclone mount to a local directory
  • use restic mount relying on rclone mount even for repository hosted on services that restic directly supports

Hope this helps, any feedback is highly appreciated ( even on my non-native english :slight_smile: ).

3 Likes

That’s very helpful and kind of you to sum this up! Can you possible elaborate a bit, by e.g. providing a set of example commands that would mount an existing repository the way you suggest, and show how to browse it when mounted? I think that would help a lot of people :slight_smile:

1 Like

I really don’t know what I was thinking after hours of searching and trying or if I was drunk when I wrote the message above. :grinning: :innocent: that doesn’t make sense because restic DOES the mount relying on fuse: since the fuse implementation on macFuse 4.2.1 is different from the one restic uses, it doesn’t work.

Anyway, based on this idea: Cannot mount on MacOS with macFUSE 4.x - #5 by cva since I’m not going to learn docker in the next few weeks, I’m trying to get a “lightweight” virtualization with mount support using https://multipass.run and ubuntu LTS and sharing mounted content via samba to Windows or macOS

I got it working and it seems pretty fast. As soon I’ll have time, I’ll try to post a tutorial, but it is really simple to get it running.

Anyway, I know that curiosity killed the cat, but I really would like to know what’s the matter about implementing restic with cgofuse

1 Like

That it requires C. It’s been discussed several times in issues on GitHub - restic wants to be pure Go for various reasons.

1 Like

Ok, I understand.

It has been wonderful using restic until I had to find a specific version of a file. The main feature I’d expect from a versioning backup system is to check for vesions quite simply. Searching in a mounted repository can be “enough” simple since you can use native os tools like find. But to use restic’s find feature in an effective way you have to rely on json output and write some code (and sadly I haven’t time to).

In your knowledge, is there any python script or other tool that allows to “isolate” all “unique” versions of a given file, based on restic output?

Thanks

2 Likes

What’s your definition of a “version” of a file? Are you saying that what you want to be able to find is in which snapshots a given file/path was changed (e.g. if you have ten snapshots and it was new in the second one, changed in the fifth and seventh, you want to get a list of snapshots two, five and seven)?

Versioning isn’t really one of restic’s goals - backups are (these are different things). But I understand you might want this.

Yes, this is what I meant saying “version”. IMHO it will be nice if docs will be updated reporting mount issues in platforms other than linux.

Windows restic version DOES NOT HAVE mount option

1 Like

Not a solution, but I found an issue that tracks this feature request: Show history of file · Issue #3073 · restic/restic · GitHub

Just citing my workaround from Issues · restic/restic · GitHub

restic find --long  /data/my_file.txt | grep -v "Found matching\|^$" | uniq

But this relies on correct mtime, i.e. if you modify a file in a way that mtime and size keeps the same, it will be identified as an identical version.

2 Likes

I just came here to make sure people knew about this! I didn’t realize Rclone could mount on MacOS 11 (Big Sur) or later. Is there any way we could either adopt Rclone’s method of mounting OR utilize Rclone for all “restic mount” commands?

But yeah as it stands, there’s no way to get a repository mounted (without a virtual / secondary machine anyway). Restic still relies on OSXFUSE. That said, Rclone can even mount on Windows too. I totally didn’t realize that. I’m hoping all of this is possible to port to Restic too - or, in the least, it’s possible to utilize Rclone to do the heavy lifting for Restic!

3 Likes

Until this is resolved, I created the following script to enable browsing of a restic archive using Docker and rclone. Rclone can serve a directory as an HTTP service, so instead of mounting to the local disk, one can access snapshots in the browser.

#!/usr/bin/env bash

# Start docker desktop if it is not running
if (! docker stats --no-stream ); then
  # On Mac OS this would be the terminal command to launch Docker
  open -a Docker
 #Wait until Docker daemon is running and has completed initialisation
while (! docker stats --no-stream ); do
  # Docker takes a few seconds to initialize
  echo "Waiting for Docker to launch..."
  sleep 1
done
fi

# create a short script for the container to mount and serve
cat <<EOF > /tmp/dscrpt
  mkdir -p /rcmount
  restic mount /rcmount &
  exec rclone serve http /rcmount -L --addr 0.0.0.0:8080
EOF
chmod +x /tmp/dscrpt

# Run a container with restic and rclone
docker run \
 --privileged \
 --device "/dev/fuse:/dev/fuse" \
 -e RESTIC_REPOSITORY=$RESTIC_REPOSITORY \
 -e RESTIC_PASSWORD="$(gpg --decrypt $HOME/.config/restic/restic_passwd.gpg)" \
 -p 127.0.0.1:8080:8080 \
 -v "$HOME/.config/rclone/rclone.conf:/root/.config/rclone/rclone.conf" \
 -v "/tmp/dscrpt:/dscrpt" \
 --entrypoint "/bin/sh" \
 tofran/restic-rclone:latest_latest /dscrpt

 # Now go to localhost:8080 in your browser to browse snapshots
3 Likes

GitHub - emuell/restic-browser: A GUI to browse and restore restic backup repositories. allows to browse and restore one file with mouse click

3 Likes

Wow… beautiful. Thanks so much. I was beginning to try jumping through hoops using WSL (except I’m almost sure that wouldn’t work as I don’t believe WSL has FUSE).

1 Like