Guide to replaceing plexdrive/unionfs with rclone cache

One thing to remember is that depending on what client you are using, if it has to transcode rather than direct play, it’ll take longer to start up. I try to do all my testing on clients that do Direct Play. Infuse on IOS and on my ATV Direct play just about everything.

So I’m trying to get some more testing but I do get files to start faster with limiting a few settings and making some tweaks.

Turning cache chunk memory off makes things 1-2 seconds slower in general from my testing so I turned it back on.

Rather than having a huge buffer, I tweaked it down to 100M as that seemed like a sweeter spot.

This seemed to give me a consistent 4s-5s media info on any file I did rather than 7-10seconds with the other settings:

/usr/bin/rclone mount gmedia: /Test \
   --allow-other \
   --dir-cache-time 24h \
   --cache-total-chunk-size 5G \
   --cache-chunk-path /dev/shm \
   --cache-chunk-size 10M \
   --cache-tmp-upload-path /data/rclone \
   --cache-tmp-wait-time 60m \
   --cache-info-age 28h \
   --cache-db-path /dev/shm \
   --cache-workers 5 \
   --buffer-size 100M \
   --log-level INFO \
   --log-file /home/felix/logs/rclone-test.log \
   --umask 002 

If you want to get something even a little faster, I have a unionfs/mergerfs type mount where I copy to my local drive and than rclone move stuff up via a cron job.

This looks like:

felix@gemini:/etc/systemd/system$ cat rclone.service
[Unit]
Description=RClone Service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount gcrypt: /GD \
   --allow-other \
   --dir-cache-time 48h \
   --cache-dir /data/rclone \
   --vfs-read-chunk-size 10M \
   --vfs-read-chunk-size-limit 512M \
   --buffer-size 100M \
   --syslog \
   --umask 002 \
   --rc \
   --log-level INFO
ExecStop=/bin/fusermount -uz /GD
Restart=on-abort
User=felix
Group=felix

[Install]
WantedBy=default.target

My mergerfs script:

felix@gemini:/etc/systemd/system$ cat mergerfs.service
[Unit]
Description=mergerFS Mounts
After=network-online.target rclone.service
Wants=network-online.target rclone.service
RequiresMountsFor=/GD

[Service]
Type=forking
User=felix
Group=felix
ExecStart=/home/felix/scripts/mergerfs_mount
ExecStop=/usr/bin/sudo /usr/bin/fusermount -uz /gmedia
ExecStartPost=/home/felix/scripts/mergerfs_find
Restart=on-abort
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=default.target

I was testing with both plexdrive which seems equal to vfs for me:

felix@gemini:~/scripts$ cat mergerfs_mount
#!/bin/bash

# PlexDrive
#/usr/bin/mergerfs -o defaults,sync_read,allow_other,category.action=all,category.create=ff /data/local:/PD_decrypt /gmedia

# RClone
/usr/bin/mergerfs -o defaults,sync_read,allow_other,category.action=all,category.create=ff /data/local:/GD /gmedia

My mergerfs always writes to the first item in that list and the second item is rw and doesn’t give me all the unionfs hidden / stuff I don’t like which is why I compiled and use mergerfs.

1 Like