How to set the directory cache in rclone rc vfs mount

What is the problem you are having with rclone?

I want to set a specific directory for rclone vfs cache. Typically we can do this using the following command when using rclone mount

rclone mount odrive: /plex --cache-dir /home/nirzak/data/plex

but when using rclone rc command and the vfsOpt option there's no such option to set vfs cache directory. the available options are below

"vfs": {
"BlockNormDupes": false,
"CacheMaxAge": 3600000000000,
"CacheMaxSize": -1,
"CacheMinFreeSpace": -1,
"CacheMode": "off",
"CachePollInterval": 60000000000,
"CaseInsensitive": false,
"ChunkSize": 134217728,
"ChunkSizeLimit": -1,
"DirCacheTime": 300000000000,
"DirPerms": 511,
"DiskSpaceTotalSize": -1,
"FastFingerprint": false,
"FilePerms": 438,
"GID": 1002,
"NoChecksum": false,
"NoModTime": false,
"NoSeek": false,
"PollInterval": 60000000000,
"ReadAhead": 0,
"ReadOnly": false,
"ReadWait": 20000000,
"Refresh": false,
"UID": 1002,
"Umask": 2,
"UsedIsSize": false,
"WriteBack": 5000000000,
"WriteWait": 1000000000

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

rclone v1.66.0

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 6.5.0-1021-oracle (aarch64)
  • os/type: linux
  • os/arch: arm64 (ARMv8 compatible)
  • go/version: go1.22.1
  • go/linking: static
  • go/tags: none

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

Onedrive

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

rclone rc mount/mount fs=odrive: mountPoint=/plex vfsOpt='{"CacheMode": 3, "CacheDir": "/home/nirzak/data/plex",  "DirCacheTime": 3600000, "BufferSize": 536870912, "ChunkSize": 536870912, "ChunkSizeLimit": -1, "CacheMaxAge": 1800000, "CacheMaxSize": 21474836480, "PollInterval": 60, "Umask": 2}' mountOpt='{"AllowOther": true}'

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

[dbox]
type = dropbox
token = XXX

[obox]
type = onedrive
client_id = XXX
client_secret = XXX
token = XXX
drive_id = XXX
chunk_size = 120M
drive_type = business

[odrive]
type = onedrive
token = XXX
drive_id = XXX
chunk_size = 120M
drive_type = business
### Double check the config for sensitive info before posting publicly

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

2025/01/28 19:36:23 DEBUG : rc: "mount/mount": with parameters map[fs:odrive: mountOpt:{"AllowOther": true} mountPoint:/plex vfsOpt:{"CacheMode": 3, "CacheDir": "/home
/nirzak/data/plex",  "DirCacheTime": 3600000, "ChunkSize": 536870912, "ChunkSizeLimit": -1, "CacheMaxAge": 1800000, "CacheMaxSize": 21474836480, "PollInterval": 60, "U
mask": 2}]
2025/01/28 19:36:23 DEBUG : : forgetting directory cache
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:23 DEBUG : OneDrive root '': Next delta token is: redacted
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:23 DEBUG : vfs cache: root is "/home/nirzak/.cache/rclone"
2025/01/28 19:36:23 DEBUG : vfs cache: data root is "/home/nirzak/.cache/rclone/vfs/odrive"
2025/01/28 19:36:23 DEBUG : vfs cache: metadata root is "/home/nirzak/.cache/rclone/vfsMeta/odrive"
2025/01/28 19:36:23 DEBUG : fs cache: switching user supplied name "/home/nirzak/.cache/rclone/vfs/odrive/" for canonical name "/home/nirzak/.cache/rclone/vfs/odrive"
2025/01/28 19:36:23 DEBUG : fs cache: switching user supplied name "/home/nirzak/.cache/rclone/vfsMeta/odrive/" for canonical name "/home/nirzak/.cache/rclone/vfsMeta/
odrive"
2025/01/28 19:36:23 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2025/01/28 19:36:23 DEBUG : OneDrive root '': Mounting on "/plex"
2025/01/28 19:36:23 DEBUG : Mount for OneDrive root '' created at /plex using mount
2025/01/28 19:36:23 DEBUG : rc: "mount/mount": reply map[]: <nil>
2025/01/28 19:36:23 DEBUG : : Root: 
2025/01/28 19:36:23 DEBUG : : >Root: node=/, err=<nil>
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:23 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:24 DEBUG : OneDrive root '': Checking for changes on remote
2025/01/28 19:36:24 DEBUG : OneDrive root '': Checking for changes on remote

maybe that --cache-dir is a global flag, not a vfs flag.

Yeah looks like only way is to set it globally

Today there is no specific VFS cache location. General one is used and shared with other rclone parts using cache. For example hasher remote uses it to store hashes' database.

Maybe sometimes it would be beneficial to have dedicated VFS cache location. Should not be very difficult to implement if somebody thinks that it is really needed and submits PR. Until then it will be global setting.

Yeah. OK I am closing this topic then as it's a global flag.

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