Rclone, vfs-cache-mode writes and Mergerfs

I am using rclone mount with encrypt and have vfs-cache-mode writes enabled as well as using mergerfs to union local files with the rclone mounted gdrive. Everything works, although I have a quesiton about how the VFS cache is/should be used . I am not seeing the cache used during playback in my application (Plex). The files in the cache location are never read when playing in the Plex app. I have even tried using --vfs-cache-mode full and see the same problem.

To test, I look through the cache to find a file to play, when I play this movie from Plex, there is a new attempt to multithread download from google drive instead of playing the copy in cache.

So, I am wondering if I need to add the cache location to my mergerfs config, so that mergerfs looks in the cache first instead of going to gdrive (for example).

Any thoughts? Again, everyhting is working fine, peformane is great, no lags or anything. I just don't see the VFS cache being used during reads.

Can you share rclone version and what you are doing to mount it ?

You wouldn't want to use vfs-cache-mode full ever as that means it downloads the entire file before playing it. If Plex is your use-case and you are using mergerfs to write locally, it should be just off, which is the default.

The options for the cache-dir and such are listed here:


I'm not sure the cache would do what you think it does as if you really wanted to cache things locally, you'd want to use the cache backend.

rclone 1.48.0 (latest), here are my rclone mount commands:

rclone mount gdrive: /mnt/gdrive --uid=1000 --gid=1000 --umask=002  --log-level=INFO --allow-other --timeout=1h --dir-cache-time=1440m --vfs-cache-mode=writes --vfs-cache-max-age=72h --vfs-read-chunk-size-limit=5192M --vfs-read-chunk-size=128M --buffer-size=128M

rclone mount tdrive: /mnt/tdrive --uid=1000 --gid=1000 --umask=002  --log-level=INFO --allow-other --timeout=1h  --dir-cache-time=1440m --vfs-cache-mode=writes --vfs-cache-max-age=72h --vfs-read-chunk-size-limit=5192M --vfs-read-chunk-size=128M --buffer-size=128M

rclone mount gcrypt: /mnt/gcrypt --uid=1000 --gid=1000 --umask=002  --log-level=INFO --allow-other --timeout=1h  --dir-cache-time=1440m --vfs-cache-mode=writes --vfs-cache-max-age=72h --vfs-read-chunk-size-limit=5192M --vfs-read-chunk-size=128M --buffer-size=128M

rclone mount tcrypt: /mnt/tcrypt --uid=1000 --gid=1000 --umask=002  --log-level=INFO --allow-other --timeout=1h  --dir-cache-time=1440m --vfs-cache-mode=writes --vfs-cache-max-age=72h --vfs-read-chunk-size-limit=5192M --vfs-read-chunk-size=128M --buffer-size=128M

Here is my mergerfs command:
mergerfs -o sync_read,auto_cache,dropcacheonclose=true,use_ino,allow_other,func.getattr=newest,category.create=ff,minfreespace=0,fsname=pgunion /mnt/move=RW:/mnt/downloads=RW:/mnt/tdrive=NC:/mnt/gdrive=NC:/mnt/tcrypt=NC:/mnt/gcrypt=NC /mnt/unionfs

My test using--vfs-cache-mode full was just to see if putting the full video file in the cache allowed Plex to play this file from the cache location. it doesn't. my logs indicate that a full download was triggered from the gdrive mount to play the file.

Again, things are working well. I am just wondering why the cache location is not used in my mergerfs config, or am I just misunderstanding what this actually does.

So, this is a misunderstanding on my part. Per the docs you linked, here is the pertinent info under the --vfs-cache-mode writes section

In this mode files opened for read only are still read directly from the remote, write only and read/write files are buffered to disk first.

1 Like

You can't "put" a file into the cache location as you'd have to let the mount do its thing.

If you got it all working, you should be good :slight_smile:

When I say "put", I mean i accessed a file in the gdrive mount, and saw that it was copied to the cache location. I then attempted to play the file a 2nd time, but the cached version is not touched during playback.

from what I am reading in the docs, this is expected behavior. If I want the cache to be used in the way I am intending then i need to set up a cache remote.

So that is another question. Can I set up a cache remote on top of all of this? or are VFS and cache remotes mutually exclusive when using rclone?

If you used vfs-cache-mode full, it would download the entire file and play it from the cache.

This part:

In this mode all reads and writes are buffered to and from disk. When a file is opened for read it will be downloaded in its entirety first.

The cache remote would sit on top of the default vfs setup and it has its own chunked reading/buffering. If you are using plex, there really isn't a need as it adds its own overhead to the mix.

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