Rclone VFS and MergerFS Setup
super-embed:
<p class="callout warning">This guide is for advanced users only. [Ultra.cc](<http://ultra.cc/>) is not responsible for any data loss or application errors due to this setup. We do not provide official support for Rclone or MergerFS. You may visit our #community-support channel on our <a href="[<https://discord.ultra.cc>](<https://discord.ultra.cc/>)">Discord server</a> for assistance.
</p>
super-embed:
<p class="callout danger">
Please make yourself aware of the [Ultra.cc](<http://ultra.cc/>) <a href="<https://ultra.cc/policies/terms-of-service#fair-usage>">Fair Usage Policy</a>. It is very important <b>NOT</b> to mount your cloud storage to any of the premade folders. Do <b>NOT</b> download directly to a Rclone mount from a torrent or nzbget client, as it will create massive instability for both you and everyone else on the server. Always follow the documentation and create a new folder for mounting. It is <em>your</em> responsibility to ensure your usage is within acceptable limits.
</p>
super-embed:
<p class="callout danger">
Please do not mount to any of the default directories such as:
<br><code>downloads</code>
<br><code>files</code>
<br><code>media</code>
<br><code>bin</code>
<br><code>.apps</code>
<br><code>.config</code>
<br><code>www</code>
<br><code>/home/username</code>
<br> or any pre-created directory found on your [Ultra.cc](<http://ultra.cc/>) Slot
</p>
Introduction
This section will teach you how to set up a Rclone VFS mount and MergerFS on a Ultra.cc service, 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 have faster loading times due to it being available locally.
- Uploads are less 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.
super-embed:
<p class="callout warning">
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.
</p>
Preparation
Install and Configure Rclone
Install and configure Rclone if you haven't already. Refer to the following guide for more information: Install, Configure & Use 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://scripts.ultra.cc/main-v2/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 Application Settings
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
~/.tmp-rclone
~/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.
- You will be given a choice between two kinds of rclone-upload scripts. One will be a normal script that will only upload your data and the other will also send a Discord notification.
- In the case that you choose the
Discord-Notification type, make sure that you have a Discord Webhook URL ready for it.
- 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 and optionally also send a discord notification upon completion.
Run the Script
- It is absolutely necessary that you know the Rclone remote name which you set up in Install, Configure & Use of Rclone before running this script.
- You can confirm your Rclone remote name by executing the following SSH command:
rclone listremotes
- Optionally, you should also have a Discord Webhook URL ready if you wish to receive Discord notifications from the
rclone-upload.sh script.
- To execute the rclone-mergerfs workflow setup script, run the SSH command given below:
bash <(wget -qO- <https://scripts.ultra.cc/main-v2/MergerFS-Rclone/rclone-mergerfs.sh>)
- Confirm that rclone-vfs and MergerFS are set up correctly by executing the following SSH command:
ls ~/MergerFS
- It should list files from your cloud storage.
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 says Show Advanced.
Enable Hardlinks
- Go to
Settings -> Media Management
- Check
Use Hardlinks Instead of Copy under Importing
- Click on
Save Changes in the top-left.
Set Root Folder
- Go to
Settings -> Media Management
- Click on
Add Root Folder under Root Folders
- Browse to
/home/your_username/MergerFS/Movies
- Click
Ok.
- All Movies in Radarr should have
/home/your_username/MergerFS/Movies as their Root Folder.
- You can have other Root Folders, but they all should be inside
/home/your_username/MergerFS.
Remote Path Mapping
- Go to
Settings -> Download Clients
- Ensure that you have already set up your Download Clients as instructed in this guide.
- Click on the
+ button to the right-hand side under Remote 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
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 says Show Advanced.
Enable Hardlinks
- Go to
Settings -> Media Management
- Check
Use Hardlinks Instead of Copy under Importing
- Click on
Save Changes in the top-left.
Set Root Folder
- Go to
Settings -> Media Management
- Click on
Add Root Folder under Root Folders
- Browse to
/home/your_username/MergerFS/TV Shows
- Click
Ok.
- All Series in Sonarr should have
/home/your_username/MergerFS/TV Shows as their Root Folder.
Remote Path Mapping
- Go to
Settings -> Download Clients
- Ensure that you have already set up your Download Clients as instructed in this guide.
- Click on the
+ button to the right-hand side under Remote 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
Connect Radarr & Sonarr to Plex / Emby
Plex Media Server
- In Plex Media Server, go to
Settings -> Network and set Secure Connections to Preferred. Then, click on Save Changes.
- In both Sonarr & Radarr, go to
Settings -> Connect and click on the + button.