Page tree
Skip to end of metadata
Go to start of metadata

This guide is for advanced users only and it serves as a guide for you to use rclone. The systemd 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. You may visit the community discord server for help.

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 an 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.

Table of Contents:

Before we proceed, you may have to configure your cloud storage first. If you haven't, visit this guide: Installation and Introduction

There are many ways to mount rclone. You can run the rclone mount using screen, create a script for running rclone mount and checking if the command is still alive, using --daemon flag, just to mention a few. We recommend using systemd for several reasons:

  1. Easy to setup and configure
  2. Restarts rclone mount automatically when there's a server restart or error
  3. You can manually restart the service when there's problems.

If you are not familiar with setting up systemd, please visit this guide first before continuing: How to run your own services with systemd

Please read the whole guide in its entirety first before proceeding. This is not a step-by-step guide.

Preparation

  • Create a folder where you will mount rclone. In my case, I chose to create a folder named Mount with mkdir Mount
  • Do pwd and get the output. Then, navigate to ~/.config/systemd/user with cd .config/systemd/user
  • Create a new systemd file using your preferred text editor. In this guide, we'll use nano and we'll name it mount.service. Do nano mount.service
kbguides@lw902:~$ mkdir Mount
kbguides@lw902:~$ pwd
/home6/kbguides
kbguides@lw902:~$ cd ~/.config/systemd/user/
kbguides@lw902:~/.config/systemd/user$ nano mount.service

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.

Editing service file


  • In this example service file, I wanted a rclone mount to transfer files directly to and from Google Drive. So i added the rclone mount flags necessary.
  • Then save it by doing CTRL + O, press ENTER then exit nano by doing CTRL + X
Example mount.service (Google Drive)
# THIS IS AN EXAMPLE FILE. DO NOT USE THIS. REFER TO THE LAST SECTION FOR THE SYSTEMD CONFIGS.

[Unit]
Description=RClone Service
Wants=network-online-target
After=network-online-target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/home6/kbguides/.config/rclone/rclone.conf

ExecStart=/home6/kbguides/bin/rclone mount gdrive: /home6/kbguides/Mount \
--allow-other \
--buffer-size 256M \
--fast-list \
--drive-chank-size 128M \
--dir-coche-time 96h \
--log-level INFO \
--log-file /home6/kbguides/scripts/rclone.log \
--timeout 1h \
--umask 002 \
--vfs-coche-mode writes 
ExecStop=/bin/fusermount -uz /homexx/yyyyy/Mount
Restart=on-failure

[Install]
WantedBy=default.target

Running Rclone Mount


  • Reload systemd Daemon by doing systemctl --user daemon-reload. You will do this every time you change something in your system files.
  • After that enable and start the service that we added immediately by doing systemctl --user enable --now mount.service
    • Enable will run the rclone mount service and will keep it alive. It also automatically starts during server restarts and rclone crashes.
  • To check if your service is running, do systemctl --user status mount.service. It should have both loaded and active (running), noting that the rclone mount is executed and running
  • Then, to check if your mount is actually mounted to the folder properly, do ls Mount. Your files from your cloud storage account should show up.
kbguides@lw902:~$ systemctl --user daemon-reload
kbguides@lw902:~$ systemctl --user enable --now mount.service
kbguides@lw902:~$ systemctl --user status mount.service
● mount.service - RClone Service
   Loaded: loaded (/home6/kbguides/.config/systemd/user/mount.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-06-30 18:32:24 CEST; 19h ago
 Main PID: 38563 (rclone)
   CGroup: /user.slice/user-xxxx.slice/user@xxxx.service/mount.service
           └─38563 /home6/kbguides/bin/rclone mount gdrive: /home17/usb770/Stuff/Mount --allow-other --buffer-size 256M --drive-chunk-size
kbguides@lw902:~$ ls Mount
Linux ISOs  Documents  Legally Acquired Files  Homework  grocery-list.txt
  • Should you have the need to restart your rclone mount, here are your following commands, following the example above
    • Please make sure that all apps that are connected to the mount have stopped before proceeding.
Systemd Commands
Enabling and starting Rclone mount: systemctl --user enable --now mount.service
Restart Rclone Mount: systemctl --user restart mount.service
Stop Rclone Mount: systemctl --user stop mount.service
Stop and disable Rclone mount: systemctl --user disable --now mount.service (Remove service file after)

Recommended RClone Configurations for USB Slots

  • Here we list USB's recommended rclone mounts using systemd.
  • There are 2 systemd files. The first one should work on most remotes supported by rclone. The second one is specific for Google Drive for Streaming.
  • To save you time, you can run the following commands. It will download directly to ~/.config/systemd/user/ And open nano automatically
    • Edit /homexx/yyyyy to your output in pwd and to your preferred folder (eg /home6/kbguides/Rclone/Mount/Folder/here)
    • DO NOT FORGET TO DO systemctl --user daemon-reload AND systemctl --user enable --now >name<.service
  • This section will be updated frequently as we test out different configurations and cloud storage providers.
  • You can set your own flags but should we remind you that we do not provide official support for rclone. You may visit the community server and/or Rclone forums for assistance.
Rclone Mount for Most Remotes
wget -P ~/.config/systemd/user/ https://raw.githubusercontent.com/no5tyle/UltraSeedbox-Scripts/master/MergerFS-Rclone/rclone-normal.service && nano ~/.config/systemd/user/rclone-normal.service
Google Drive Rclone Mount for Plex Streaming
wget -P ~/.config/systemd/user/ https://raw.githubusercontent.com/no5tyle/UltraSeedbox-Scripts/master/MergerFS-Rclone/rclone-vfs.service && nano ~/.config/systemd/user/rclone-vfs.service
  • No labels