I’ve been trying to get rclone to mount my encrypted volume via a systemd service on a Ubuntu 16.04 box for a few hours now, haven’t succeeded and would really appreciate some help. I have the following rclone config: drive -> cache -> crypt. I’m trying to mount the crypt into /media/gdrive (which exists on the filesystem).
I’ve created an rclone.service with the following contents:
However when I try to start the service (either manually or on a reboot) I get the following:
systemd[1]: Started RClone Service.
systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
fusermount[1396]: /bin/fusermount: failed to unmount /media/gcrypt: Invalid argument
systemd[1]: rclone.service: Control process exited, code=exited status=1
systemd[1]: rclone.service: Unit entered failed state.
systemd[1]: rclone.service: Failed with result 'exit-code'.
What’s odd is that running the ExecStart and ExecStop commands with sudo in terminal works fine which leaves me at a loss because I’m not too savvy with systemd services. Can anyone tell me where I’m going wrong?
Also once I’m got this sorted what is the best way to get data onto gdrive? I have approx 1.5TB to backup. Is sync the way forward? Should I unmount before running it?
This is what my systemd config looks like for the mount which serves beta.rclone.org. Probably the major difference is the Type=notify - rclone understands systemd notifications so maybe that will help?
I would use rclone sync or rclone copy to transfer the data - that is the most reliable way. You don’t need to stop the mount - it will gradually appear in the mount when the --dir-cache-time 72h expires.
Yes you are right of course. The polling interval will poll for changes on drive every minute and changes will arrive much quicker than the directory expiring.
So I switched it out for Type=notify and it appears to be working with a couple of other changes.
Turns out I can run both the commands without the need for sudo. I’m guessing since I set the mount point to be owned by my user it’s not gonna complain.
I originally used my own user but it failed for other (most likely) permission reasons. I’ve taken your advice and switched back to using my user.
I fiddled a little more and the following systemd service appears to work (using systemctl start rclone.service in terminal)…
If you are using the cache, you should not hit any API bans.
You can either limit the transfer with the bwlimit and let it run majority continuously or you can max-transfer and just maybe do 500GB a day. I tend to leave some buffer as I am more conservative.
Thanks for the suggestions @Animosity022 I’ll bear them in mind when syncing.
It turns out I have to unmount the gdrive prior to running sync which seems a little odd. It complained that there was no cache.db or something to that effect (even though the cache.db file mentioned exists locally). I guess it’s not really a problem while I sync everything. Afterward, I’m guessing if I want to use the gcrypt instead of the local storage I just put files and folders in the mount and it does all the necessary.