Can someone explain FUSE and mounting

I do not understand what is actually happening when I perform

restic mount <my_local_path>

In my specific case, I want to be able to mount my repository to my local drive so that I can “look around in it”. I am about to get rid of an older computer that is backed up, and I would love to be able to just keep the repo in the cloud (restic is connected to BackBlaze as the repo in my case), and perform restic mount <my_local_path> to grab specific files that I need off of the old computer.

I am the sort of person who just copies the whole user directory when getting a new computer, and over the years, clutter has piled up. I am hoping that intelligent usage of Restic can avoid that. (I am trying to “Marie Kondo” my digital life a little.)

So here are my main questions, but knowing my use case, maybe you all have some other important things to tell me:

  1. When I perform restic mount /mnt/oldComputer, will all of the files sitting in BackBlaze be brought down onto my computer in the /mnt/oldComputer path? Or are pointers and file hierarchy the only thing copied, and nothing is really copied until I find my file of interest and explicitly copy it via something like cp /mnt/oldComputer/cute_video.mp4 ~/Videos?
    • Also, is there a way to only mount a particular backup via restic mount, or is everything mounted? If the mount itself takes up little disk space, this may be moot.
    • When I umount and remove that FUSE connection, is everything removed from that /mnt/oldComputer path? Is that the best way to interact: restic mount, look for the file of interest, then umount?
  2. Is my workflow robust / acceptable, assuming I can trust BackBlaze not to lose any files/objects. (And I am assuming I can.)
    • Can I treat the repository as the only backup, and just mount to it whenever I want files?
    • The benefit of reducing electronic clutter is, for me at this point, almost as important as ensuring I do not lose anything important to me.
  3. If I look up FUSE on Wikipedia or something, it “just” seems like an interface to deal with privileges and security related things. I don’t really see (a) why restic specifically mentions fuse in its documentation, or (b) why it is important in understanding what is happening.
    • I guess what I am saying is this: is the documentation just assuming we all know what fuse is, and if we do not, is the documentation therefore more confusing than helpful?
    • As a curious person, is there something of interest I should take away from FUSE that makes it cool in a particular way that Restic cleverly utilizes?
1 Like
  1. NOTHING is copied to your disk when you mount. What you get is a “virtual file system” which shows what is in your repo. If you want something locally, you need to copy.
  2. You need to decide your level of “paranoia”, if only one backup at Backblaze is good enough for you.
  3. FUSE makes it possible for non-root users to mount stuff. And it is a way of representing stuff which are not a regular file system, which is the case with restic mount. Your backup is a bunch of files which in no way have a one-to-one relationship with the files you backed up, but restic mount is doing some “magic” to show you the files and folders as they were at the time of your backup.
3 Likes

For practical intents and purposes, consider it a regular mount that you do of a disk or whatever at a path. Not much different, it’s just that it’s done through FUSE.

2 Likes

Thank you very much, @martinleben and @rawtaz !!

I had thought that nothing was copied, but just wanted to double check. :slight_smile:

Regarding the reason why restic uses FUSE (primarily because it is not a “normal” file system and instead file chunks being represented as normal files via FUSE’s magic), that makes total sense and helps me appreciate what is happening and why.

Thanks again, y’all!

1 Like

@martinleben I’m new in restic and trying to study restic in my Linux Manjaro PC.I succeeded well until this: Restoring using mount.

I just do not know how to implement (put into practice) the instruction of the restic Manual on this question:

Quote ''Mounting repositories via FUSE is only possible on Linux, macOS and FreeBSD. On Linux, the fuse kernel module needs to be loaded and the fusermount command needs to be in the PATH ‘’ Unquote

You say that restorred files can be found into ‘virtual file system’ instead of /mnt/restic.

Could you please explain where and/or how can I find this ‘‘virtual file system’’ in my Linux Manjaro machine so that I can then copy the files from ‘‘virtual file system’’ back to my normal PC file system ? Some practical examples of terminal commands to reach this goal would be highly appreciated. Many thanks to you in advance. :grinning:

I don’t have a Manjaro system at hand to test, but I would expect Manjaro to have FUSE installed by default. You can check by running this command:

user:~$ which fusermount
/usr/bin/fusermount

If a path is printed you are probably good to go, else you need to install the FUSE package.

Mounting the repository should be as easy as this (add your credentials as needed):

user:~$ mkdir ./restic-mount && restic mount ./restic-mount
1 Like

@764287 Thank you very much for your advice. Unfortunately I got this negative result ‘exit status 1’ in my Terminal:

   /mnt  restic -r /home/…/srv/restic-repo1 mount ./restic-mount
enter password for repository:
repository eb3a83a5 opened successfully, password is correct
fusermount: exit status 1
also, the following messages were logged by a library:
2021/08/27 17:25:04 mount helper error: fusermount: user has no write access to mountpoint /mnt/restic-mount
unable to umount (maybe already umounted or still in use?): exit status 1: fusermount: entry for /mnt/restic-mount not found in /etc/mtab
   /mnt   1 ✘  14s 

It says that ‘‘fusermount user has not write access to mountpoint /mnt/restic-mount.’’ Thererfore I checked my usr/bin/fusermount3. It says: ’’ Since you are not the owner of this target, you can not change the rights of this target’’.

Is there a way to get out from this loop ? Now I can only open separate snapshots but not restic-mount.

For instance, with Veracrypt I do not have problem with mounting.

Is /mnt/restic-mount owned by your current user? Do you have write access to this directory? Have you tried adding a directory in your users home path and use that?

@764287 I re-installed ./restic-mount into mnt:

   /mnt  sudo mkdir ./restic-mount  :heavy_check_mark:
[sudo] xxxx-user password:
   /mnt  ls -a  :heavy_check_mark:  8s 
. … restic-mount
   /mnt   :heavy_check_mark:

Opening this /mnt/restic-mount says Owner has read and write rights, root and Others has ‘right to open’. It says also: ’’ Since you are not the owner of this target, you can not change the rights of this target’’.

I opened ./restic-open directory directly into /home. Here it ended with the same rights and limitations as above within mnt.

After this I tried at first to create ./restic-mountinto /home/user, but Terminal refused. In the end I created normal /restic-mount directory into /home/user/ and there I’m the owner and have all rights. . And here .I get successful result ! Here I can read all data of snapshots in the corresponding restic-repo. Then I hide this directory by renaming it with a dot, i.e. .restic-mount.

Both unmounting and cleaning up work OK.

I want to thank you very much for you help and advice !! :grinning: :grinning: :grinning:

Glad to hear you got it working. :+1: :robot:

@764287 @martinleben With ref to discussion above about ‘Restoring using mount’ I tested also possibility to create restic-mount directory into . /tmp, i.e. /tmp/restic-mount. This way the command is a little bit shorter and restoration takes place in directory for temporary folders and files. PC user has ownership and full rights to this /tmp/restic-mount from the very beginning.

   /tmp  mkdir restic-mount  1 ✘
   /tmp 
   /  restic -r /home/user/srv/restic-repo1 mount /tmp/restic-mount

enter password for repository:
repository eb3a83a5 opened successfully, password is correct
Now serving the repository at /tmp/restic-mount
When finished, quit with Ctrl-c or umount the mountpoint.
signal interrupt received, cleaning up
   / 

After Cltr + c or unmout mountpoint the /tmp/restic-mount directory is empty. All this works easy and smoothly in my restic 0.12.1 on Linux Manjaro 21.1.0.

Since I believe you are in good contacts with restic developers and Manual editors, would it be possible for you to propose to them to edit section ‘Restoring using mount’ of the Manual in this part

$ mkdir /mnt/restic
$ restic -r /srv/restic-repo mount /mnt/restic

with this instead:
$ cd tmp
tmp $ mkdir restic-mount
$ restic -r /srv/restic-repo mount /tmp/restic-repo

  • a small edition of the end of 2nd sentence following after this part of the Manual i.e. :
    ‘’ Mounting repositories via FUSE is only possible on Linux, macOS and FreeBSD. On Linux, the fuse kernel module needs to be loaded…[ and the fusermount command needs to be in the PATH ] = delete the text inside these [ ]

I guess this same would work for all OS’s, not only for Linux distributions. I could try next week with Win10, iOS Mac I do do not have.

I agree that changing the example path to /tmp (or user’s home path) should be less error prone.
@rawtaz: What do you think?

It might be necessary to provide some examples on how to test for fuse support.

Mounting is not supported on Windows.

@764287 Thank you for you reply and thoughts around this questions. This discussion is part of ormal evolution of open source software, I’ll keep my fingers crossed.

I’ll keep in mind in my next week restic test week with Windows (10 Pro on a Win + Ubuntu dual-boot laptop environment) what you say about mounting not supported in Windows. :grinning:

I’m fairly new to Linux (Debian/Gnome) and switching from the BackBlaze client on Windows to Restic / Resticprofiles. To ’ test’ ability to restore I wanted to mount a repository. Never knew what mounting was so followed the same documentation as mentioned above.

But after setting the environment I put this in the terminal to mount repo “b2:JoelLaptopLinux:InternalN”:

restic -r b2:JoelLaptopLinux:InternalN mount /mnt/InternalN

It will show this:

repository 1c10137f opened (version 2, compression level auto)
[0:00] 100.00% 11 / 11 index files loaded
fusermount: exit status 1
also, the following messages were logged by a library:
2023/11/12 17:47:15 mount helper error: fusermount: user has no write access to mountpoint /mnt/InternalN
unable to umount (maybe already umounted or still in use?): exit status 1: fusermount: entry for /mnt/InternalN not found in /etc/mtab

I dont have a clue how to proceed so any help is appreciated.

:rofl: :+1: very nice!

You can mount a repository at any point in the filesystem for example in your home folder and not just in /mnt. Judging from the error message, you’re not allowed to write to /mnt or /mnt/InternalN.

1 Like

Got it working, maybe it didnt help I tried mounting in a NextCloud synchronised folder either.
Put it somewhere else in my homefolder and worked!

2 Likes