Numeric values for rc params. What format?

What is the problem you are having with rclone?

I'm moving from a standalone rclone mount setup to the one driven by rcd and rc. I'm trying to understand numeric defaults for parameters passed with rc, like "ReadAhead" or "CacheMaxAge". For size: is it bytes? For time: seconds, milliseconds or... ?

Reason why I'm asking. Standard rclone params accept format of "6h" or "1G". These are no longer accepted as rc params. Not much in documentation either.

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

rclone v1.67.0

  • os/version: darwin 15.0 (64 bit)
  • os/kernel: 24.0.0 (arm64)
  • os/type: darwin
  • os/arch: arm64 (ARMv8 compatible)
  • go/version: go1.22.4
  • go/linking: dynamic
  • go/tags: cmount

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

SFTP

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

./rclone rc mount/mount fs="v3:/home/user/haha/" mountPoint="v3" \
  vfsOpt='{"CacheMode": 3, "CacheMaxAge": 864000, "CacheMaxSize": 5368709120, "ReadAhead": 52428800, "WriteWait": 3000, "WriteBack": 3000}' \
  mountOpt='{"VolumeName": "v3", "LogFile": "log.txt", "LogLevel": "ERROR", "PollInterval": 9000}'

original command I'm trying to replicate

./rclone --config rclone.conf cmount --vfs-cache-mode full --cache-dir cache --poll-interval 15m --vfs-cache-max-age 168h --vfs-cache-max-size 5g --vfs-read-ahead 50m --vfs-write-wait 30s --vfs-write-back 30s --volname v3 --daemon --log-file log.txt --log-level ERROR v3:/home/user/haha/ v3

Check rc docs.

duration is in nanoseconds
size is in bytes

You can check what you have set using vfs/stats

1 Like

Thanks, appreciate it. That will be a lot of zeros to supply...

1 Like

You should also be able to supply the params as strings in rclone format, so "5s" or "5G"

This is explained in the docs here

Hi Nick. Thank you for the answer.
I know it should work (hey... I RDFM before) and it works for bare rclone commands, but here is what I'm getting.

Sample command

./rclone rc mount/mount fs="v3:/home/aaa/bbb/" mountPoint="v3" \
  vfsOpt='{"CacheMode": 3, "CacheMaxAge": "24h", "CacheMaxSize": "5G", "ReadAhead": "50M", "WriteWait": "30s", "WriteBack": "30s"}' \
  mountOpt='{"VolumeName": "v3", "LogFile": "log.txt", "LogLevel": "ERROR"}'

Output

Failed to rc: operation "mount/mount" failed: key "vfsOpt": json: cannot unmarshal string into Go struct field Options.CacheMaxAge of type time.Duration

...and if I correct the 1st param, it keeps repeating for other ones (size or time). looks like a type conversion issue? it clearly expects a number / int.

EDIT: If I use values without " I'll get something like:

Failed to rc: operation "mount/mount" failed: key "vfsOpt": invalid character 'h' after object key:value pair

Looking at the code, it seems not all the vfs options are defined with the fancy types that make this possible.

Types fs.SizeSuffix and fs.Duration will work but int64/time.Duration won't.

That is something I may well fix soon as I'm currently revamping the config system to unify the command line and the RC config for all config, not just the backend options.

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