Synology (Docker)

rclone mount on Synology NAS with Docker

This will use a Docker container to mount your google drive and then make the mount available to the host (your NAS)

A warning, I have very little experience with docker, so I suggest being careful with any information you find here. I got it to work through trial and error and the stuff here is the results of that!!

If you need help you can find me on the plex forum or rclone forum @blim5001

First thing, obviously, is make sure you have installed Docker from the package manager

If you followed the instructions from [here](Install rclone on Synology NAS), you should already have a working rclone on your nas and so have a config file that we can use with the docker image.

I found that the Synology Docker GUI leaves a lot to be desired and they seem to dumb it down further with newer DSM updates, so for some of the process you will need to use the command line and the docker run command.


IMPORTANT

While I could get my drive mounted within the container I could not make it available to the NAS. I got this error:

docker: Error response from daemon: linux mounts: Path /path/on/your/nas/to/directory/to/put/the/mount is mounted on /volume1 but it is not a shared mount.

As I have my google drive mounted mine in a directory inside volume1, I had to run this command:

sudo mount --make-shared /volume1

I am not sure if there could be possible issues with doing this. SO USE AT YOUR OWN RISK

FWIW I have done this and have not encountered any problems, I have rebooted the NAS and it all appears ok so far.

[EDIT except I had to re run the sudo mount --make-shared /volume1 command, so now just need to work out how to make that stick across reboots]

For more info about this, here are the resources I found:

https://docs.portworx.com/knowledgebase/shared-mount-propagation.html
https://www.ibm.com/developerworks/library/l-mount-namespaces/index.html
https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt

So if you are still here, create a directory somewhere on your NAS that will be the the location where the mounted drive will appear.

(I am currently in 2 minds as to where this should be, I guess it depends on wether you want to be able to browse to the mounted drive from the Synology File manager and/or your shares.)

Now launch Docker on your NAS and go and get this container
https://hub.docker.com/r/mumiehub/rclone-mount/

Once you have this container installed, you should be able to run the command below

This is an example of the docker run command:

sudo docker run -d --name rclone-mount \
    --restart=unless-stopped \  
    --cap-add SYS_ADMIN \
    --device /dev/fuse \
    --security-opt apparmor:unconfined \
    -e RemotePath="gDrive:" \
    -e MountCommands="--allow-other --allow-non-empty --read-only" \
    -e ConfigName="rclone.conf" \
    -v /path/to/directory/where/your/config/file/is:/config \
    -v /path/on/your/nas/to/directory/to/put/the/mount:/mnt/mediaefs:shared \ 
    mumiehub/rclone-mount

You will need to change the paths to suit your environment and you will need to add to the MountCommands, the ones I have put are just for example.

I am currently using these MountCommands for plex:

--allow-other --allow-non-empty --read-only --dir-cache-time 672h --vfs-cache-max-age 675h --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G --buffer-size 32M

NOTE: I suggest mounting it as Read Only as Synology has a nasty habit of creating @eaDir directories all over the place and I would rather these do not get written to the google drive.

Once you have started it using the docker run command, it should then appear as a container in the Docker GUI in the DSM and you you can start and stop it from there.

If you need to change your config/options you will need to stop it in the DSM and then use the shell again and run this (change rclone-mount if you gave yours a different name):

sudo docker container rm rclone-mount

You can then re-run the docker run command with your new parameters