Rclone Mount when SSH Connection Closes

What is the problem you are having with rclone?

I used fusermount to unmount my gdrive before I restarted my computer (local). I then restarted it and upon trying to remount my gdrive, got an error stating that there is another rclone running on the same remote. I run rclone mount through an ssh connection to my seedbox where everything is set up. I am wondering if the ssh connection must be left open to keep the mount running. Upon runningn fusermount again, it comes up with an error stating that the entry is not found in /etc/mtab. I have had this problem before and it was fixed by killing the rclone process and remounting. I am just wondering of another way to fix this problem and if the mount closes when the ssh connection closes, as I don't have root permissions and must ask for assistance every time I wish to kill the rclone process.

What is your rclone version (output from rclone version)

v1.48.0

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10 (local)
Ubuntu (seedbox)

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone mount gcrypt: ~/mnt/gdrive &

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

There are a couple ways to keep something running from the Linux side.

You can use a systemd service if you have root access. Here is mine that I use:

[root@gemini system]# cat gmedia-rclone.service
[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf

ExecStart=/usr/bin/rclone mount gcrypt: /GD \
--allow-other \
--buffer-size 1G \
--dir-cache-time 96h \
--log-level INFO \
--log-file /opt/rclone/logs/rclone.log \
--timeout 1h \
--umask 002 \
--user-agent animosityapp \
--rc
ExecStop=/bin/fusermount -uz /GD
Restart=on-failure
User=felix
Group=felix

[Install]
WantedBy=multi-user.target

You can also run with "--daemon" option if you do not have root access and that runs it in the background. So instead of using the "&", you'd replace that with --daemon and it'll run the process in the background.

The problem is that I don't have root access as it is a shared seedbox. Right now I am resorting to using the command "ps aux | grep rclone" and killing the process in order to restart it.

If you don't have root access, you can use the --daemon flag to spawn it off and it will run in the background.

Okay, so I should just use my normal mount and add --daemon as a flag? Just specifying for sure. Also, what do you recommend for a mount command? Right now, I am just using a couple very simple flags with 'rclone mount gcrypt: ~/mnt/gdrive &'.

I just would add:

--allow-other --dir-cache-time 96

Allow-other lets other users see the mount assuming you aren't running plex as the same user as rclone.

Since Google Drive polls every minute, it helps in terms of speed to use dir-cache as a large value.

I will use the --dir-cache-time 96, but I can't use --allow-other, as I don't have root permissions to change the config file.

Oh right, sorry about that, I forgot you can run it with allow-other but it requires root to modify the fuse.conf.

My preferred method of keeping something running is tmux.
If you're able to get that installed on your box, I think you'll really like it's features. Very easy and intuitive to use.

Lets you open a "new" terminal, run some command, then detach from it. Any time you want after that, you can re-attach and see what's going on. You could think of it as kind of like ssh'ing into a spare terminal window kind of situation.

What does allow-other do anyway? I have rclone set up to transfer files to gdrive which is where Plex looks for the files. I don't really see the point in using allow-other, as I also have others on the server who are able to access the files through Plex.

If you run rclone as a user say "joe" and some other process run as "bob", allow-other let's bob see joe's rclone mount.

Otherwise, only the same user can see it, which requires root access to update the fuse.conf on the system to make it work.

Okay. What exactly does the --Daemon flag do?

daemon runs it in the background so you don't have to stay logged in.

So in Linux, you can run the rclone mount command and add in --daemon and it will continue to run while you can log out.

So if I am running the --daemon flag on the mount from a windows machine mounting to a linux server and close the ssh window or restart my computer, it will keep going? Is it determined by my network after I add the flag so if I restarted my router it would unmount?

So the place that rclone is running on is the Linux server.

If you connect to the Linux server and you run the process with --daemon, it will continue to run if exit the session connected to the Linux server.

Nothing should cause it to unmount other than restarting the Linux server.

Okay. Thank you for the reply. What would I do if I were to change servers? How would I be able to access the content in my gdrive from another server? Would I need to have the --allow-other flag in order to do this?

No,

The allow-other means you log into your server as one user but other users can access it.

If you are moving to a new server you'd just set up rclone again and remount it with the same command.

the --daemon just means when you close ssh it does not close the current running mount.

Please note if you restart the server you will need to run the command again.

Hope that helps and makes sense.

1 Like

Okay. Sounds good.

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