Rclone VFS and MergerFS Setup - Scripted
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, Ultra.cc 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
/home/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 19:00 CET, 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
-
Install MergerFS
- Run the command given below in 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.
bash <(wget -qO- https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/Installer%20Scripts/mergerfs-install.sh)
- To confirm if the installation is completed, do
which mergerfs
ultradocs@pollux:~$ which mergerfs
/home/ultradocs/bin/mergerfs
- Change your application settings accorinding to rclone Optimizations for Apps.
Setup the Work Flow using a Script
What does the script do?
- The script will set up the workflow for you.
- It will create the following directories on your service:
~/Stuff/Mount
~/Stuff/Local/Downloads/torrents
~/Stuff/Local/Downloads/usenet
~/MergerFS/Movies
~/MergerFS/TV Shows
~/scripts
- The following systemd services will be created by it to mount rclone-vfs and mergerfs respectively:
~/.config/systemd/user/rclone-vfs.service
~/.config/systemd/user/mergerfs.service
- Finally, it will also save the rclone-upload script and set a cronjob to run it in your crontab. The
rclone-upload.sh
script will be saved in the following location:
~/scripts/rclone-upload.sh
- The
rclone-upload.sh
script will be set to move data to your cloud drive daily at 19:00 CET.
Run the Script
- To execute the script, run the SSH command given below:
bash <(wget -qO- https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/MergerFS-Rclone/rclone-mergerfs.sh)
Helpful Information for managing this new Work Flow
- Log locations.
- rclone-vfs mount:
~/scripts/rclone_vfs_mount.log
- mergerfs mount:
~/scripts/mergerfs_mount.log
- rclone-upload:
~/scripts/rclone-upload.log
- rclone-vfs mount:
- systemd commands.
- Stop systemd services:
systemctl --user stop <servicename>.service
- For example:
systemctl --user stop rclone-vfs.service mergerfs.service
will stop both the rclone-vfs mount and the mergerfs mount. - Restart systemd services:
systemctl --user restart <servicename>.service
- Stop systemd services:
- Tips about the rclone-upload script.
- Manually run the script:
bash ~/scripts/rclone-upload.sh
. - This is in case you want to move the data and not wait for the cronjob to do it.
- It is also recommended to check the
rclone-upload.log
the next day after you have finished this setup to confirm that your daily uploads are working.
- Manually run the script:
Set Sonarr Correctly
- To take advantage of your new MergerFS work flow, you must set up Sonarr correctly.
- As soon as you login to Sonarr, go to
Settings
and click on the cog that saysShow Advanced
.
Enable Hardlinks
- Go to
Settings -> Media Management
- Check
Use Hardlinks Instead of Copy
underImporting
- Click on
Save Changes
in the top-left.
Set Root Folder
- Go to
Settings -> Media Management
- Click on
Add Root Folder
underRoot Folders
- Browse to
/home/your_username/MergerFS/TV Shows
- Click
Ok
. - All Series in Sonarr should have
/home/your_username/MergerFS/TV Shows
as theirRoot Folder
.- You can have other Root Folders, but they all should be inside
/home/your_username/MergerFS
.
- You can have other Root Folders, but they all should be inside
Remote Path Mapping
- Go to
Settings -> Download Clients
- Ensure that you have already set up your Download Clients.
- Click on the
+
button to the right-hand side underRemote Path Mappings
. - Set up the Remote Path Mapping as given below:
Host: {username}.{servername}.usbx.me
Remote Path: /home/your_username/Stuff/Local/Downloads
Local Path: /home/your_username/MergerFS/Downloads
- Click on Save.
Connect Plex Media Server / Emby
Plex Media Server
GoIn Sonarr, go toSettings -> Connect
and click on the+
button.- Choose
Plex Media Server
. - Set it up with the details given below:
Name : Anything as per your preference.
Notification Triggers: Check `On Download`, `On Upgrade`, `On Rename`.
Host: {servername}.usbx.me
Port: Plex Media Server's port as given in your Ultra Control Panel.
Use SSL: Unchecked
Update Library: Checked
- Click on
Authenticate with Plex.tv
. - It will autoamtically fill the
Auth Token
field. - Click on
Test
and thenSave
.
Emby
- Login to your Emby instance.
- Go to
Manage Emby Server -> Advanced -> Api Keys
- Click on
+ New Api Key
and add the App name asSonarr
. Then clickok
. - Now, go to
Settings -> Connect
and click on the+
button in Sonarr. - Choose
Emby
. - Set it up with the details given below:
Name : Anything as per your preference.
Notification Triggers: Check `On Download`, `On Upgrade`, `On Rename`.
Host: {servername}.usbx.me
Port: Emby's port as given in your Ultra Control Panel.
Use SSL: Unchecked
API Key: Paste the one which was created earlier.
Update Library: Checked
- Click on
Test
and thenSave
.
Set Radarr Correctly
- To take advantage of your new MergerFS work flow, you must set up Radarr correctly.
- As soon as you login to Radarr, go to
Settings
and click on the cog that saysShow Advanced
.
Enable Hardlinks
- Go to
Settings -> Media Management
- Check
Use Hardlinks Instead of Copy
underImporting
- Click on
Save Changes
in the top-left.
Set Root Folder
- Go to
Settings -> Media Management
- Click on
Add Root Folder
underRoot Folders
- Browse to
/home/your_username/MergerFS/Movies
- Click
Ok
. - All Movies in Radarr should have
/home/your_username/MergerFS/Movies
as theirRoot Folder
.- You can have other Root Folders, but they all should be inside
/home/your_username/MergerFS
.
- You can have other Root Folders, but they all should be inside
Remote Path Mapping
- Go to
Settings -> Download Clients
- Ensure that you have already set up your Download Clients.
- Click on the
+
button to the right-hand side underRemote Path Mappings
. - Set up the Remote Path Mapping as given below:
Host: {username}.{servername}.usbx.me
Remote Path: /home/your_username/Stuff/Local/Downloads
Local Path: /home/your_username/MergerFS/Downloads
- Click on Save.
Connect Plex Media Server / Emby
Plex Media Server
GoIn Radarr, go toSettings -> Connect
and click on the+
button.- Choose
Plex Media Server
. - Set it up with the details given below:
Name : Anything as per your preference.
Notification Triggers: Check `On Download`, `On Upgrade`, `On Rename`.
Host: {servername}.usbx.me
Port: Plex Media Server's port as given in your Ultra Control Panel.
Use SSL: Unchecked
Update Library: Checked
- Click on
Authenticate with Plex.tv
. - It will autoamtically fill the
Auth Token
field. - Click on
Test
and thenSave
.
Emby
- Login to your Emby instance.
- Go to
Manage Emby Server -> Advanced -> Api Keys
- Click on
+ New Api Key
and add the App name asRadarr
. Then clickok
. - Now, go to
Settings -> Connect
and click on the+
button in Radarr. - Choose
Emby
. - Set it up with the details given below:
Name : Anything as per your preference.
Notification Triggers: Check `On Download`, `On Upgrade`, `On Rename`.
Host: {servername}.usbx.me
Port: Emby's port as given in your Ultra Control Panel.
Use SSL: Unchecked
API Key: Paste the one which was created earlier.
Update Library: Checked
- Click on
Test
and thenSave
.
Set your Download Clients Correctly
- Sonarr and Radarr both must add their downloads to directories inside
/home/your_username/Stuff/Local/Downloads
. - To achieve this, you will have to make changes in your download clients.
Torrent Clients
rTorrent
- In Sonarr/Radarr itself, go to
Settings -> Download Clients
. - Click on the rTorrent download client.
- Locate the
Directory
setting and set it to:/home/your_username/Stuff/Local/Downloads/torrents
- Click on
Save
.
Deluge
- In Deluge, it's default download path will have to changed. Therefore, it is not recommmended to use Deluge in this work flow.
- Login to your Deluge instance.
- Click on
Preferences
and go toDownloads
- Set the
Download to:
folder to/home/your_username/Stuff/Local/Downloads/torrents
- Click on
Apply
, and thenOk
.
qBittorrent
- Login to your qBittorrent instance.
- Go to
Options -> Downloads
. - Under
Saving Management
, set the following settings:
Default Torrent Management Mode: Automatic
When Torrent Category changed: Relocate torrent
- Click on
Save
. - For Sonarr
- Find the
tv-sonarr
category. If your Sonarr is using a different category with qBittorrent, edit that one. - Right-click on it and choose
Edit category..
- Set the
Save path:
to/home/your_username/Stuff/Local/Downloads/torrents
- Find the
- For Radarr
- Find the
radarr
category. If your Radarr is using a different category with qBittorrent, edit that one. - Right-click on it and choose
Edit category..
- Set the
Save path:
to/home/your_username/Stuff/Local/Downloads/torrents
- Find the
Transmission
- In Sonarr/Radarr itself, go to
Settings -> Download Clients
. - Click on the Transmission download client.
- Locate the
Directory
setting and set it to:/home/your_username/Stuff/Local/Downloads/torrents
- Click on
Save
.
Usenet Clients
- You can optionally create two more directories to better sort your Series and Movies.
mkdir -p ~/Stuff/Local/Downloads/usenet/Sonarr
mkdir -p ~/Stuff/Local/Downloads/usenet/Radarr
NZBGet
- For Radarr
- By default, Radarr sets the NZBGet download client to use the
Movies
category. - You must change the
DestDir
of this category in your NZBGet instance. If you are using a different category, change theDestDir
of that one. - Login to your NZBGet instance.
- Go to
CATEGORIES
and find theMovies
category. - Set the
DestDir
to/home/your_username/Stuff/Local/Downloads/usenet/Radarr
- Click on
Save all changes
.
- By default, Radarr sets the NZBGet download client to use the
- For Sonarr
- By default, Sonarr sets the NZBGet download client to use the
tv
category. However, this is not already present in NZBGet and often has to be added. - You must change the
DestDir
of the category in your NZBGet instance. If you are using a different category, change theDestDir
of that one. - Login to your NZBGet instance.
- Go to
CATEGORIES
and find thetv
category. - Set the
DestDir
to/home/your_username/Stuff/Local/Downloads/usenet/Sonarr
- Click on
Save all changes
.
- By default, Sonarr sets the NZBGet download client to use the
SABnzbd
- For Radarr
- By default, Radarr sets the SABnzbd download client to use the
movies
category. - You must change the
Folder/Path
of this category in your SABnzbd instance. If you are using a different category, change theFolder/Path
of that one. - Login to your SABnzbd instance.
- Go to
Config -> Categories
and find themovies
category. - Set the
Folder/Path
to/home/your_username/Stuff/Local/Downloads/usenet/Radarr
- Click on
Save
.
- By default, Radarr sets the SABnzbd download client to use the
- For Sonarr
- By default, Sonarr sets the SABnzbd download client to use the
tv
category. - You must change the
Folder/Path
of this category in your SABnzbd instance. If you are using a different category, change theFolder/Path
of that one. - Login to your SABnzbd instance.
- Go to
Config -> Categories
and find thetv
category. - Set the
Folder/Path
to/home/your_username/Stuff/Local/Downloads/usenet/Sonarr
- Click on
Save
.
- By default, Sonarr sets the SABnzbd download client to use the
Set your Media Server Applications Correctly
Plex Media Server
- Your
Movies
library should point to the following folder:/home/your_username/MergerFS/Movies
. - Your
TV Shows
library should point to the following folder:/home/your_username/MergerFS/TV Shows
. - Any other library folders should also be inside
/home/your_username/MergerFS
. - Official Plex support article on Editing Libraries.
Emby
- Your
Movies
library should point to the following folder:/home/your_username/MergerFS/Movies
. - Your
TV Shows
library should point to the following folder:/home/your_username/MergerFS/TV Shows
. - Any other library folders should also be inside
/home/your_username/MergerFS
.
JellyFin
- Your
Movies
library should point to the following folder:/home/your_username/MergerFS/Movies
. - Your
TV Shows
library should point to the following folder:/home/your_username/MergerFS/TV Shows
. - Any other library folders should also be inside
/home/your_username/MergerFS
.