Rclone Mount using systemd
When to Use SystemD Method?
- Follow this method only if you plan to read from your rclone mount and not upload/write any data to it periodically.
- In the case that you wish to upload data to your cloud drive periodically, please follow Rclone VFS and MergerFS Setup.
Overview
rclone's Mount allows you to mount any of your cloud storage accounts as part of your slot's file system using FUSE. In this guide, we will teach you how to run a rclone mount using systemd. Take note that this guide is setup using Google Drive as the cloud storage provider used. Should you use any other cloud storage providers, you may need consult rclone documentation for the appropriate flags for your setup.
There are many ways to mount rclone. You can run the rclone Mount using the screen
utility, create a script for running rclone Mount, and checking if the command is still alive, using the --daemon
flag, just to mention a few.
We recommend using systemd for several reasons:
- Easy to set up and configure
- Restarts rclone Mount automatically when there's a server restart or error
- You can manually restart the service when there is problems.
Rclone Mount without Mergerfs
If you don't need to upload files to your mount, follow this guide.
Should you need to upload files or you're planning an automated setup involving your cloud storage, we recommend using Rclone VFS and MergerFS Setup instead.
Preparation
- Login to your service via SSH.
- Ensure rclone is installed following Rclone Installation Mounting will not work without this.
- Then, create the mount and temp folder
- For this guide, we'll be making a folder named Mount. So we will run
mkdir -p ~/Stuff/Mount && mkdir ~/.tmp-rclone
kbguides@lw902:~$ mkdir -p ~/Stuff/Mount && mkdir ~/.tmp-rclone
kbguides@lw902:~$
- Next, create a folder named
scripts
. This is where you'll find logs of the rclone mounts should there be any problems.
kbguides@lw902:~$ mkdir ~/scripts
kbguides@lw902:~$
- Confirm your remote name by running
rclone listremotes
and take note of the name you've set.
$ kbguides@lw902:~$ rclone listremotes
Gsuite:
Download Rclone Service File
- Choose and run the following command below
- There are 2
system
files listed here. You have to choose either one of these files. - The first one should work on most remotes supported by rclone.
- The second one is specific for Google Drive that is optimized for streaming.
Rclone Mount for Most Remotes
wget -P ~/.config/systemd/user/ https://scripts.ultra.cc/main-v2/MergerFS-Rclone/Service%20Files/rclone-normal.service && nano ~/.config/systemd/user/rclone-normal.service
Google Drive Rclone Mount for Media Streaming
wget -P ~/.config/systemd/user/ https://scripts.ultra.cc/main-v2/MergerFS-Rclone/Service%20Files/rclone-vfs.service && nano ~/.config/systemd/user/rclone-vfs.service
Edit your service file
- After you run the command, a nano text window appears. In this example service file, we'll be using Google Drive Rclone Mount for Plex Streaming.
- Replace
remote:
to the remote name you set previously from the previous guide. - You may also add or edit some rclone flags here if you wish.
- Then save it by doing CTRL + O, press ENTER then exit nano by doing CTRL + X.
Example rclone-normal.service
Example rclone-vfs.service
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)
If you require further assistance, you can open a support ticket here!
Feedback and suggestions regarding this article are welcome on our Discord server