Unable to mount Rclone remote using systemd

Hi,

I have two systemd services to mount my Movies and TV Shows folders for use with Plex on my Raspberry Pi 3 and am unable to auto-mount it after boot.

Movies systemd
[Unit]
Description=gdrive-team_media_mount
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=pi
ExecStart=/usr/bin/rclone mount --daemon --config=/home/pi/.config/rclone/rclone.conf --allow-other --fast-list media:Movies/ /gdrive_team/movies
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
TV Shows systemd
[Unit]
Description=gdrive-team_media_mount
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=pi
ExecStart=/usr/bin/rclone mount --daemon --config=/home/pi/.config/rclone/rclone.conf --allow-other --fast-list media:TV\ Shows/ /gdrive_team/tv_shows
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

What is the problem you are having with rclone?

systemd says that the services are active, however Rclone is not mounted.

Movies
pi@pi:~ $ sudo systemctl status gdrive-team_movies
● gdrive-team_movies.service - gdrive-team_media_mount
   Loaded: loaded (/etc/systemd/system/gdrive-team_movies.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-08-22 18:48:44 IST; 16ms ago
 Main PID: 4249 (rclone)
    Tasks: 1 (limit: 2200)
   Memory: 128.0K
   CGroup: /system.slice/gdrive-team_movies.service
           └─4249 /usr/bin/rclone mount --daemon --config=/home/pi/.config/rclone/rclone.conf --allow-other --fast-list media:Movies/ /gdrive_team/movies

Aug 22 18:48:44 pi systemd[1]: Started gdrive-team_media_mount.
TV Shows
pi@pi:~ $ sudo systemctl status gdrive-team_tv-shows
● gdrive-team_tv-shows.service - gdrive-team_media_mount
Loaded: loaded (/etc/systemd/system/gdrive-team_tv-shows.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2019-08-22 18:55:09 IST; 206ms ago
Main PID: 5306 (rclone)
Tasks: 7 (limit: 2200)
Memory: 3.4M
CGroup: /system.slice/gdrive-team_tv-shows.service
       └─5306 /usr/bin/rclone mount --daemon --config=/home/pi/.config/rclone/rclone.conf --allow-other --fast-list media:TV\ Shows/ /gdrive_team/tv_shows

Aug 22 18:55:09 pi systemd[1]: Started gdrive-team_media_mount.

df doesn't show the mounted file systems. Although I'm not sure whether it's to blame but tmp_upload_path and chunk_path are located on a local hard disk, formatted HFS+.

rclone version

rclone v1.48.0
- os/arch: linux/arm
- go version: go1.12.6

Which cloud storage system are you using? (eg Google Drive)

Google Drive - Team/Shared Drive

Change that from simple to notify

Remove --daemon

Mine looks like:

[felix@gemini system]$ cat gmedia-rclone.service
[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf

ExecStart=/usr/bin/rclone mount gcrypt: /GD \
--allow-other \
--cache-dir /data/rclone \
--vfs-cache-mode writes \
--dir-cache-time 96h \
--log-level INFO \
--log-file /opt/rclone/logs/rclone.log \
--timeout 1h \
--umask 002 \
--rc
ExecStop=/bin/fusermount -uz /GD
Restart=on-failure
User=felix
Group=felix

[Install]
WantedBy=multi-user.target
1 Like

That did it.
.
.
If I use a HFS+ formatted local drive for storing the tmp uploads and chunks, do I need to set any special permissions for it? Also how do I store the directory structure so it isnt reloaded each time?

The best bet is to have a larger dir-cache-time so it stays in memory longer as there isn't anything to make it persistent or store it.

You can use the cache backend to achieve this functionality, but it's a bit slower imo and uses local disk space for chunking.

Cloud storage in general has no concept of permissions so when I mount it, I use the user and group I want in my systemd file and ensure that the proper umask is set to get the right permissions I want.

My use case is my own home server / no other users and I am in complete control so I have a pretty broad user/group read write setup.

Is —cache-dir used to store opened files?

Nothing is stored with the default backend as it's all memory and that is influenced by buffer-size

So if I set the cache directory to the local hard disk and a large buffer, it will be stored there right?

Let's break it down a bit to make sure I get the right answer.

If you are reading a file, that's all done via memory and nothing is ever stored on disk. This is influenced by buffer-size.

If you write a file, that's written directly to your remote based on your setup.

If you want to take a look at the cache backend, that does chunk storage locally for files that are being read. I personally don't use it.

https://rclone.org/cache/

I’m confused between the VFS and the cache thing.

Can you elaborate on what you have a question about?

Yeah sure. I use Rclone for Plex, LAN file browsing and occasional uploads. Do you think I should use VFS or cache backend?

Also do I need to add --vfs-cache-max-size int, --vfs-cache-max-age duration?

This is my systemd at the moment, would you suggest any changes?

Thanks.

[Unit]
Description=gdrive-team_media_mount
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount \
--config=/home/pi/.config/rclone/rclone.conf \
--allow-other \
--cache-dir=/disks/1TB/rclone/cache-dir \
--vfs-cache-mode minimal \
--fast-list \
media:Movies/ /media/movies
Restart=always
RestartSec=10
ExecStop=/bin/fusermount -u /media/movies
User=pi
Group=pi

[Install]
WantedBy=multi-user.target
1 Like

Yep. I have all my settings here:

I think I do an ok job of explaining why I have certain settings. I do not use the cache backend. I wouldn't use minimal caching either.

Ok thanks for that.

The other issue I'm facing from my RPi 3B+ is that the read speed of files is very slow.
I have a reasonably fast connection but files take too long to open and then it buffers while playing back a video file from a rclone mount.

I'd suggest to open up a new thread and share all your relevant information and we can help see if there is an issue.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.