Rclone VFS and MergerFS Setup

This guide is for advanced users only and it serves as a guide for you to use rclone and mergerFS. The files here are the recommended settings for our slots and will subject to change whenever there are new configurations that are appropriate for the slots. Furthermore, USB is not responsible for any data loss or application errors due to this setup should you proceed and will not provide official support for it due to the large volume of variables and different configurations possible with rclone and mergerFS. You may visit the community discord server or the software's respective forums for assistance.

Please make yourself aware of the Ultraseedbox Fair Usage Policy. It is very important not to mount your Cloud storage to any of the premade folders, this creates massive instability for both you and everyone else on your server. Always follow the documentation and create a new folder for mounting. It is your responsibility to ensure usage is within acceptable limits. Ignorance is not an excuse.

This guide will teach you how to setup a rclone VFS mount and MergerFS on USB slots and it assumes the following:

  • You have a working rclone setup, especially correctly configured remotes of your preferred cloud storage provider. In this tutorial, we’ll be using Google Drive. If you use another cloud storage provider, change the flags that are appropriate to your setup and visit rclone documentation for more information.
  • You have the appropriate knowledge of setting up and running your own systemd services.
  • You are comfortable working in CLI, compiling from sources and setting up cron jobs.

The workflow of the setup is as follows:

  1. There are 2 folders, one local and the rclone mount named Mount
  2. These 2 folders are merged via MergerFS and is mounted to another folder. All apps such as Plex, Radarr, Sonarr and such will be pointed to this folder.
  3. When you copy a file to MergerFS, this will be copied to Local First. Directory structures will be retained.
  4. A rclone move script moves all the contents inside Local every 3AM, retaining the directory structures.
  5. Applications that are pointed to MergerFS wouldn’t know the difference.

Pros of this setup are as follows:

  1. New files will be immediately available in Plex and has faster loading times due to it being available locally.
  2. Uploads is lesser prone to errors than moving files directly via rclone mount.
  3. It's essentially a “set it and forget it“ setup

Cons of this setup are as follows:

  1. New files will not be available on Google Drive until you run the rclone move script
  2. There will be 3 points of failure on this setup, RClone, apps that are connected to the MergerFS folder and MergerFS
  3. Monitoring functions such as Plex's “Update my library automatically“ will not work for mounts. You may need to set your application to periodically scan the mount.

Before we proceed, it is imperative to stop all rclone/plexdrive processes and stop all the apps that are connected to your rclone mount before proceeding.


  • Install and configure rclone if you haven't already. Refer here for more information: Installation, Configuration & Usage of rclone
  • Create all the necessary folders.
    • First, a local folder and a rclone mount folder. You can put these folders anywhere in your home folder but I’d like to put these inside another folder. We'll name it Stuff just to make it cleaner.
    • Then, we create another folder where we’ll mount MergerFS. Let’s name it MergerFS.
    • Lastly, create a scripts folder. This is where you'll find logs for your rclone/mergerfs mounts. This is where you'll store the bash upload script if you choose the bash upload script, which will be explained more later.

/home6/kbguides/Stuff/ #Folder where 2 MergerFS folders are in
    -Local #servers as our local mount
    -Mount #Rclone mount point
/home6/kbguides/MergerFS/ #actual mergerfs mount point
/home6/kbguides/scripts/ #Where you'll find logs for rclone/mergerfs mounts
  • Doing this in SSH, the following commands are
mkdir -p ~/Stuff
mkdir -p ~/Stuff/Local
mkdir -p ~/Stuff/Mount
mkdir -p ~/MergerFS
mkdir -p ~/scripts

Do not attempt to mount your rclone remote directly on your home directory. This will lead to instabilities. Instead, always mount to an empty folder within your home directory.

Installing MergerFS

  • Run this command to your terminal. This should automatically install MergerFS to your slot.
    • Select 1 or 2 when prompted. We recommend selecting 2 when prompted by the installer.
wget https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Installer%20Scripts/mergerfs-install.sh
bash "$HOME"/mergerfs-install.sh && rm "$HOME"/mergerfs-install.sh
  • To confirm if the installation is completed, do which mergerfs
kbguides@lw902:~$ which mergerfs

Setting up systemd files and running MergerFS/Rclone

  • Do pwd and take note of the output. In this case, the output is /home6/kbguides
kbguides@lw902:~$ pwd
  • Confirm your remote name by running rclone config and take note of the name you've set. Once that's done, type q to quit config.
$ rclone config
Current remotes:

Name                 Type
====                 ====
gdrive               drive 

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config

  • Then, run the following commands to your terminal
    • This will download the latest revisions of the service files from our repository directly to your systemd folder.
  • After you run the commands, a nano text window appears.
    • Edit /homexx/yyyyy to your output in pwd and to your preferred folder.
    • Replace remote: to the remote name you set previously from the previous guide.
    • Then save it by doing CTRL + O, press ENTER then exit nano by doing CTRL + X.
    • In these systemd files, these are for Google Drive and is the recommended settings for our slots (Plex Streaming)
    • You may wish to add or edit additional flags/options that will be best for your setup.
      • We recommend starting off with our defaults first.

rclone VFS Service

wget -P $HOME/.config/systemd/user/ https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Service%20Files/rclone-vfs.service && nano $HOME/.config/systemd/user/rclone-vfs.service

mergerfs Service

wget -P $HOME/.config/systemd/user/ https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Service%20Files/mergerfs.service && nano $HOME/.config/systemd/user/mergerfs.service

Shown below are example service files. Do not copy and paste anything from the example files as it does not always reflect the contents of the service files from our repository and in this guide. Please read the guide thoroughly before setting it up.

Example Rclone Service File

Description=RClone VFS Service


ExecStart=/home6/kbguides/bin/rclone mount gdrive: /home6/kbguides/Stuff/Mount \
  --config /home6/kbguides/.config/rclone/rclone.conf \
  --use-mmap \
  --dir-cache-time 1000h \
  --poll-interval=15s \
  --vfs-cache-mode writes \
  --tpslimit 10

ExecStop=/bin/fusermount -uz /home6/kbguides/Stuff/Mount


Example MergerFS Service File

Description = MergerFS Service

ExecStart=/home6/kbguides/bin/mergerfs \
    -o use_ino,func.getattr=newest,category.action=all \
    -o category.create=ff,cache.files=auto-full,threads=8 \
    /home6/kbguides/Stuff/Local:/home6/kbguides/Stuff/Mount /home6/kbguides/MergerFS

ExecStop=/bin/fusermount -uz /home6/kbguides/MergerFS

  • Reload systemd daemon by doing systemctl --user daemon-reload
  • Enable and start the two systemd services by doing the following
    • systemctl --user enable --now rclone-vfs && systemctl --user enable --now mergerfs
  • Confirm that everything works by going back to your home folder and do ls MergerFS
    • If your MergerFS won't mount you may want to try version 2.28.3 to do so run rm ~/bin/mergerfs && rm ~/bin/mount.mergerfs and re-run the mergerfs installer script at the top.

Setting Up Rclone Uploader

  • Here, we will set up the uploader. The rclone uploader is a script that uploads the contents of your Local folder and merge it to your rclone mount.
  • You may choose between Bash Upload script or Systemd service.
  • We recommend using the systemd uploader

Systemd Uploader

  • Run the following commands to your terminal
    • This will download the latest revisions of the service files from our repository directly to your systemd folder.
    • After you run the commands, a nano text window appears.
    • Edit /homexx/yyyyy to your output in pwd and to your preferred folder.
    • Replace remote: to the remote name you set previously from the previous guide.
    • Then save it by doing CTRL + O, press ENTER then exit nano by doing CTRL + X.
wget -P $HOME/.config/systemd/user/ https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Upload%20Scripts/rclone-uploader.service && nano $HOME/.config/systemd/user/rclone-uploader.service && wget -P $HOME/.config/systemd/user/ https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Upload%20Scripts/rclone-uploader.timer

Example Rclone Upload Service File

Description=RClone Uploader


ExecStart=/home6/usbdocs/bin/rclone move /home6/usbdocs/Stuff/Local/ gdrive: \
    --config=/home6/kbguides/.config/rclone/rclone.conf \
    --drive-chunk-size 8M \
    --tpslimit 1 \
    --drive-acknowledge-abuse=true \
    -vvv \
    --delete-empty-src-dirs \
    --fast-list \
    --bwlimit=2M \
    --use-mmap \
    --transfers=1 \
    --checkers=1 \
    --drive-stop-on-upload-limit \
    --log-file /home6/kbguides/scripts/rclone-uploader.log


Example Rclone Timer File

Description=Run Rclone Upload daily


  • Reload systemd daemon by doing systemctl --user daemon-reload
  • Enable and start the two systemd services by doing the following
    • systemctl --user enable --now rclone-uploader.service && systemctl --user enable --now rclone-uploader.timer
  • This will start the service immediately and starts uploading any files that you have on your Local folder.

Bash Upload Script

  • Download this script to whatever folder you wish. In this case, scripts will be the folder where you'll save the script.
    • You may choose between the normal upload script (no notifications) or the rclone upload script that sends discord notifications whenever there's a successful transfer.
  • Change the script's permission to 755, so it makes it executable by you. So do chmod +x >name of script<.sh
    • In the proceeding examples, I decided to use the normal rclone script so do chmod +x rclone-upload.sh

Normal Upload Script

cd scripts/
wget https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Upload%20Scripts/rclone-upload.sh
chmod +x rclone-upload.sh

Upload Script with Discord Notifications via Webhook

cd scripts/
wget https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Upload%20Scripts/rclone-upload-with-notification.sh
chmod +x rclone-upload-with-notification.sh
  • Then open the script using your preferred text editor and change the values as needed.
    • Both normal and upload script with discord notifications needs to be setup before using it
    • Replace remote: to the remote name you set previously from the previous guide.

Example rclone-upload.sh file



trap 'rm -f "$lock_file"; exit 0' SIGINT SIGTERM
if [ -e "$lock_file" ]
    echo "Rclone upload script is already running."
    rm "$HOME"/scripts/rclone-upload.log
    touch "$lock_file"
    "$HOME"/bin/rclone move "$HOME"/Stuff/Local/ gdrive: \
        --config="$HOME"/.config/rclone/rclone.conf \
        --drive-chunk-size 64M \
        --tpslimit 5 \
        -vvv \
        --drive-stop-on-upload-limit \
        --delete-empty-src-dirs \
        --fast-list \
        --bwlimit=8M \
        --use-mmap \
        --transfers=2 \
        --checkers=4 \
        --log-file "$HOME"/scripts/rclone-upload.log
    rm -f "$lock_file"

Example rclone-upload-with-notification.sh file


# Rclone upload script with optional Discord notification upon move completion (if something is moved)
# Recommended for use via cron
# For example: */10 * * * * /path/to/rclone-upload.sh >/dev/null 2>&1
# -----------------------------------------------------------------------------




# -----------------------------------------------------------------------------

trap 'rm -f $LOCK_FILE; exit 0' SIGINT SIGTERM
if [ -e "$LOCK_FILE" ]
  echo "$0 is already running."
  touch "$LOCK_FILE"
  rclone_move() {
      "$HOME"/bin/rclone move -vP \
      --config="$HOME"/.config/rclone/rclone.conf \
      --user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36' \
      --drive-chunk-size 8M \
      --use-mmap \
      --delete-empty-src-dirs \
      --fast-list \
      --log-file="$LOG_FILE" \
      --stats=9999m \
      --tpslimit=1 \
      --transfers=1 \
      --checkers=1 \
      --bwlimit=2M \
      --drive-stop-on-upload-limit \
    # "--stats=9999m" mitigates early stats output 
    # "2>&1" ensures error output when running via command line
    echo "$rclone_command"

  if [ "$DISCORD_WEBHOOK_URL" != "" ]; then
    rclone_sani_command="$(echo $rclone_command | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g')" # Remove all escape sequences

    # Notifications assume following rclone ouput: 
    # Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA - Errors: 0 Checks: 0 / 0, - Transferred: 0 / 0, - Elapsed time: 0.0s

    transferred_amount=${rclone_sani_command#*Transferred: }
    transferred_amount=${transferred_amount%% /*}
    send_notification() {
      output_transferred_main=${rclone_sani_command#*Transferred: }
      output_transferred_main=${output_transferred_main% Errors*}
      output_errors=${rclone_sani_command#*Errors: }
      output_errors=${output_errors% Checks*}
      output_checks=${rclone_sani_command#*Checks: }
      output_checks=${output_checks% Transferred*}
      output_transferred=${rclone_sani_command##*Transferred: }
      output_transferred=${output_transferred% Elapsed*}
      output_elapsed=${rclone_sani_command##*Elapsed time: }
        "username": "'"$DISCORD_NAME_OVERRIDE"'",
        "avatar_url": "'"$DISCORD_ICON_OVERRIDE"'",
        "content": null,
        "embeds": [
            "title": "Rclone Upload Task: Success!",
            "color": 4094126,
            "fields": [
                "name": "Transferred",
                "value": "'"$output_transferred_main"'"
                "name": "Errors",
                "value": "'"$output_errors"'"
                "name": "Checks",
                "value": "'"$output_checks"'"
                "name": "Transferred",
                "value": "'"$output_transferred"'"
                "name": "Elapsed time",
                "value": "'"$output_elapsed"'"
            "thumbnail": {
              "url": null
      /usr/local/bin/curl -H "Content-Type: application/json" -d "$notification_data" $DISCORD_WEBHOOK_URL 
    if [ "$transferred_amount" != "0" ]; then


  rm -f "$LOCK_FILE"
  • Then, decide how often you want to execute the script. Our servers are in the Netherlands so the timezone is set to CET
    • In my case, I’d like to run the script at 1900 CEST every night. Translated to cron, that is 0 19 * * *

If you need help in translating the time you want to cron, you can visit Crontab Guru and World Time Buddy to help you with setting up the time.

kbguides@lw902:$ cd ~/scripts
kbguides@lw902:~/scripts$ readlink -f rclone-upload.sh
  • Open up crontab -e, set your preferred text editor (in this tutorial, nano) and add the cron expression and the absolute path of the upload script.
  • Add > /dev/null 2>&1 if you don’t want your slot to send messages when the upload script fails.

  • Save cron by doing CTRL + O and CTRL+ X to exit the editor
  • Now, all you need to do is to access all your apps and point it to your newly made MergerFS folder which is MergerFS

Systemd Commands

Enabling and starting Rclone mount: systemctl --user enable --now {mount-name}.service
Restart Rclone Mount: systemctl --user restart {mount-name}.service
Stop Rclone Mount: systemctl --user stop {mount-name}.service
Stop and disable Rclone mount: systemctl --user disable --now {mount-name}.service (Remove service file after)

App Optimizations

  • You may need to tweak some of your apps so it plays well with your MergerFS setup. Refer to the following page for more information on these tweaks.

rclone Optimizations for Apps

Revision #41
Created Tue, Sep 10, 2019 6:56 AM by Xan
Updated Tue, Jan 26, 2021 6:34 PM by Joe