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 Ultra.cc 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.

Please do not mount to any of the default directories such as:
files
media
bin
.apps
.config
www
/homexx/username/
or any pre-created directory found on your Ultra.cc Slot

This section will teach you how to set up a rclone VFS mount and MergerFS on Ultra.cc 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:

  • There are 2 folders, one local and the rclone mount named Mount
  • 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.
  • When you copy a file to MergerFS, this will be copied to Local First. Directory structures will be retained.
  • A rclone move script moves all the contents inside Local every 3AM, retaining the directory structures.
  • Applications that are pointed to MergerFS wouldn't know the difference.

The Pros of this setup are as follows:

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

And, the cons of this setup are as follows:

  • New files will not be available on Google Drive until you run the rclone move script
  • There will be 3 points of failure on this setup, RClone, apps that are connected to the MergerFS folder and MergerFS
  • 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.

Preparation

  • 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
    • Then, we create another folder where we'll mount MergerFS.
    • Lastly, create a scripts folder.
FILE STRUCTURE

/homexx/Stuff/ #Folder where 2 MergerFS folders are in
    -Local #servers as our local mount
    -Mount #Rclone mount point
/homexx/MergerFS/ #actual mergerfs mount point
/homexx/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

::: warning 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 mergerfs-install.sh
rm mergerfs-install.sh
  • To confirm if the installation is completed, do which mergerfs
kbguides@lw902:~$ which mergerfs
/home6/kbguides/

Setting up systemd files and running MergerFS/Rclone

  • Confirm your remote name by running rclone listremotes and take note of the name you've set.
$ @lw666:~$ rclone listremotes
Gsuite:
  • 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.
    • 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
Example Rclone Service File

Example MergerFS Service File

Annotation-on-2021-08-11-at-20-25-32.png

  • 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