Rclone mount helper remount support

What is the problem you are having with rclone?

Rclone mounted filesystems on fstab can't remount. Using an fstab entry with systemd, on systemd reloads a reload is triggered on the mount configuration, which gives an error. I can trigger the same manually using mount -o remount

Systemd uses the mount option remount to reload a mount point.

/etc/fstab entry:

my_gdrive: /mnt/rclone/gdrive rclone allow_other,uid=1000,gid=401,_netdev,x-systemd.automount,rw,config=/etc/rclone.conf,cache-dir=/var/lib/rclone/gdrive,args2env,vfs-cache-mode=writes,vfs-cache-max-size=10G,vv 0 2

Mounting and unmounting works as expected.

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

rclone 1.59.0
- os/version: nixos 22.05 (Quokka) (64 bit)
- os/kernel: 5.15.56 (aarch64)
- os/type: linux
- os/arch: arm64
- go/version: go1.18.4
- go/linking: dynamic
- go/tags: cmount

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

Google Drive and OneDrive, but I don't think the remote matters.

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

$ systemctl reload mnt-rclone-gdrive.mount
Job failed. See "journalctl -xe" for details.
mount -o remount /mnt/rclone/gdrive

The rclone config contents with secrets removed.

type = drive
scope = drive
token = # REDACTED

A log from the command with the -vv flag

$ journalctl -u mnt-rclone-gdrive.mount
Aug 02 14:37:09 apollo systemd[1]: Reloading /mnt/rclone/gdrive_osmano807...
Aug 02 14:37:09 apollo mount[232178]: Error: unknown flag: --remount
Aug 02 14:37:09 apollo mount[232178]: Usage:
Aug 02 14:37:09 apollo mount[232178]:   rclone mount remote:path /path/to/mountpoint [flags]
Aug 02 14:37:09 apollo mount[232178]: Flags:


Aug 02 14:37:09 apollo mount[232178]: Use "rclone [command] --help" for more information about a command.
Aug 02 14:37:09 apollo mount[232178]: Use "rclone help flags" for to see the global flags.
Aug 02 14:37:09 apollo mount[232178]: Use "rclone help backends" for a list of supported services.
Aug 02 14:37:09 apollo mount[232178]: 2022/08/02 14:37:09 Fatal error: unknown flag: --remount
Aug 02 14:37:09 apollo systemd[1]: mnt-rclone-gdrive.mount: Mount process exited, code=exited, status=1/FAILURE
Aug 02 14:37:09 apollo systemd[1]: Reload failed for /mnt/rclone/gdrive.

Not saying that's not some defect / bug but I did have a different question.

What's the reason to use the /etc/fstab and the systemd.mount part? Why not use use a regular service? Does the mount provide something different?

It's mostly for systemd.automount to unmount when not used with x-systemd.idle-timeout=Xs, extending the instructions on rclone mount.

It's not usual to hit a reload operation, I only triggered it because my configuration system auto triggers reload on systemd unit file modifications. Automount still works, just that changing some mount parameters triggers a reload.

Ah, thanks. I keep my mount up all the time so was just curious on the use case. Appreciate the answer!

I assume what is happening here is that the mount code is translating -o remote into a --remount option for rclone mount.

What should happen when -o remount is passed in? Will the mount be already mounted? I guess it will. Maybe systemd can unmount the mount first because I don't think we can sensibly implement -o remount other than by unmounting and remounting which isnt quite the same thing! Or rclone mount could just return and do nothing if --remount was passed in and leave you with the old mount with config unchanged?