How to rclone mount & unmount properly without fusermount errors?

I have an rclone config for mega which I mount it via

rclone mount mega: ~/mega --vfs-cache-mode writes

Everytime I unmount via

fusermount -u ~/mega

It throws

mega: Failed to unmount: exit status 1: fusermount: failed to unmount ~/mega: Device or resource busy

I have two questions:

  1. What's the proper way to mount & then unmount ?
  2. Everytime I force umount, it leaves an open running instance under mega Security Settings > Session History (which get piled up on frequent usage). How to avoid this situation ?

fusermount is the right way.

You have to stop all IO/processes on the amount for it to unmount.

I do that by systemd and making all my services that use it dependent on the rclone service.

You can use fuser to see what processes are hitting it.

I've solved it btw. Just needed to end with &
rclone mount mega: ~/mega --vfs-cache-mode writes &
Then fusermount saned out.

@Animosity022 I don't think it's a good idea to run rclone as root just to automount it. You can do it from home too, especially when you config your cloud storage as a user.
I usually started mounting with .bash_profile, then unmounting via .bash_logout.

That just puts a process in the background.

Where did I say to run it as root?

As I shared above, that works great except if you have processes/IO running against it and it won't unmount. You have to remove all processes from the mount to unmount it as that's how network mount works.

Which is exactly what I wanted. I couldn't be running a rclone mount daemon in a terminal minimized right. Just put it in bg & access mount via my favorite file manager.

And yah. I've misunderstood systemd service as a root only method (I've just remembered that I can also do it via --user)

& and daemon are generally doing the same thing overall.

Scenario is still the same though as if you aren't stopping processes and ensuring they are not hitting the mount, it won't unmount when you log out.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.