Question about using rclone as systemd mount helper

What is the problem you are having with rclone?

I've got a decently working solution for mounting 3x Google Drive shares at once using information from my previous post that I want help with to set up as a systemd mount (and then, automount).

The config that seems to work well:

rclone mount gdrives: /mnt/clouds/gdrive --cache-dir /var/cache/rclone.gdrives 
--vfs-cache-mode full 
--dir-cache-time 8760h 
--vfs-cache-max-age 24h 
--vfs-read-chunk-size 16M 
--vfs-read-chunk-size-limit 2G 
--vfs-refresh 
--allow-other 
--allow-root 
--allow-non-empty 
--async-read=true 
--buffer-size 32M 
--rc

The documentation that I'm reading is confusing (to me) in attempting to set this up. Referencing the rclone mount help section Rclone as a Unix mount helper as well as @Animosity022's gh page rclone mount helper script I see some things that I'm (probably) confusing myself on.

Both help and that gh post show one of the options, --allow-other in my working mount, written as allow_other, but then another option also used in my setup, --vfs-cache-mode=full gets rendered in the files as vfs-cache-mode=full (though the example uses writes, it's the same option nonetheless).

My confusion stems from one option changing - to _ but the other not. Is this because of their placement relative to the args2env option? If so, could I place all these options after args2env and avoid having to change - to _?

Or, is it because the options after args2env all contain values, and the preceding ones are just direct use arguments?

Also, as a side note, the example systemd .mount files (in both places) reference /var/rclone for cache, but the fstab entry references /var/cache/rclone instead for cache-dir, not that that makes any sort of issue, just pointing it out for consistency (unless this was written intentionally?).

Run the command 'rclone version' and share the full output of the command.

rclone v1.75.0
- os/version: gentoo 2.18 (64 bit)
- os/kernel: 7.2.2-gentoo-dist-bin (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.26.5
- go/linking: static
- go/tags: none

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

Google Drive, 3s separate personal accounts, merged into a single mount

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

Recreating this template:

# /etc/systemd/system/mnt-data.mount
[Unit]
Description=Mount for /mnt/data
[Mount]
Type=rclone
What=sftp1:subdir
Where=/mnt/data
Options=rw,_netdev,allow_other,args2env,vfs-cache-mode=writes,config=/etc/rclone.conf,cache-dir=/var/rclone

for my setup as such:

# /etc/systemd/system/mnt-data.mount
[Unit]
Description=Mount for Google Drives
After=network-online.target
[Mount]
Type=rclone
What=gdrives:
Where=/mnt/clouds/gdrive
Options=rw,allow_other,allow_root,allow_non_empty,async_read=true,buffer_size=32M,args2env,vfs-cache-mode=full,dir-cache-time=8760h,vfs-cache-max-age=24h,vfs-read-chunk-size=16M,vfs-read-chunk-size-limit=2G,vfs-refresh,config=/etc/rclone.conf,cache-dir=/var/cache/rclone.gdrive

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[gdrive-1]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
token = XXX
team_drive =

[gdrive-2]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
token = XXX
team_drive =

[gdrive-3]
type = drive
scope = drive
client_id = XXX
client_secret = XXX
token = XXX
team_drive =

[gdrives]
type = combine
upstreams = 1=gdrive-1: 2=gdrive-2: 3=gdrive-3:
description = Combined Google Drive remotes

A log from the command that you were trying to run with the -vv flag

No log - asking a setup question

So, yeah, that's it. Trying to figure out if there is a particular way I should include the options, and if my supposition about the - to _ thing is real, or just in my head.

yeah the underscore vs hyphen thing tripped me up too when i first did mount helpers.

from what i've seen:

  • stuff like allow_other / allow_root is fuse option syntax (fstab/mount style), so those want underscores
    • rclone's own flags after args2env stay rclone-shaped, so vfs-cache-mode=full with hyphens is expected there
    • so its less "all dashes become underscores" and more "fuse opts vs rclone opts"
      personally i've had fewer headaches just using a normal systemd service (Type=notify, ExecStart=/usr/bin/rclone mount ..., ExecStop=/bin/fusermount -uz ...) with an EnvironmentFile for the long flag list, then a matching .automount if i want on-demand. the mount-helper path works, but the docs read like two dialects glued together.

if you paste the .mount unit you're drafting i can sanity check the args2env split before you let it loose on three gdrives

That sounds like a plan - and thanks for the distinction of fuse v. rclone flags, that makes sense.

I'll get that working in the AM and post back a working draft.