Installing rclone and Plex on a VPS with encrypted Google Drive

After trying many different programs, versions and settings to connect to Google Drive for streaming, I eventually settled on rclone with vfs. My biggest limitations were only having 1GB of RAM and 30GB of Storage on the VPS I wanted to use, which shaped my decisions. My VPS is in Australia, which may have affected the speed of different solutions somewhat.

rclone setup

I'm running Debian 9.6 on my VPS which uses systemd. You'll have to modify the commands and/or init script if you're using a different package manager or init system.

# Install FUSE (for mounting the rclone file system)
apt install fuse
# Install the latest rclone version
curl | bash
# Setup rclone
rclone config

Setup two remotes, the first one a standard Google Drive remote and the second a crypt remote pointing at a folder on the Google Drive remote. For example, if you named the Google Drive remote drive you could point the crypt remote at drive:storage to store it in a folder called storage.

Service Setup

Next, edit /etc/systemd/system/rclone.service. Here's my configuration for an example

Description=Google Drive (rclone)

ExecStart=/usr/bin/rclone mount crypt: /mnt/drive \
   --config /root/.config/rclone/rclone.conf \
   --allow-other \
   --dir-cache-time=24h \
   --fast-list \
   --vfs-read-chunk-size=96M \
   --drive-chunk-size 32M \
   --vfs-read-chunk-size-limit off
   --cache-dir=/root/.config/rclone/cache \
   --buffer-size=32M \
   --attr-timeout=1s \
   --log-file=/root/.config/rclone/log \
   --stats=5s \
   --stats-log-level=NOTICE \

ExecStop=/bin/fusermount -uz /mnt/drive


You will need to change the mount point and the remote name in the first ExecStart line, and you may need to remove the Before=docker.service line if you are not using Docker. You will need to change /root/ to the user you have used to configure rclone if you are not using root.

The most important lines for performance here are the following

# Improves file browsing performance considerably most of the time, may not work for you
# Force files to be downloaded in chunks of at least 96MB - putting this higher will improve speed for high bitrate files but increases the inital buffering period and RAM usage.
--drive-chunk-size 32M
# Force files to be uploaded in chunks for 32M, the higher you put this the faster uploading will be at the cost of RAM usage
--vfs-read-chunk-size-limit off
# Allows read chunks to be as big as needed
# Buffers 32M ahead when reading files in RAM. Increasing this may or may not increase performance at the cost of RAM usage. This is per file.

Start and enable the service to start up on boot

systemctl daemon-reload
systemctl start rclone
systemctl enable rclone

Running Plex

You can use the command below to run linuxserver's plex image. The official Plex image should also work, but you will have to edit the command.

docker create \
--name=plex \
--net=host \
-e VERSION=latest \
-e PUID=0 -e PGID=0 \
-e TZ=Australia/Sydney \
-v /config/plex:/config \
-v /mnt/drive:/data/ \
-v /config/transcode:/transcode \

Replace the TZ variable with your own time zone and change the paths to correspond with your rclone directory and config directories.

SSH tunnel to port 32400 on your server, and go to to setup Plex.

You can do this as such using PuTTY on Windows

Add the forwarded port as following, then open a session and log in. You should now be able to access Plex at After the initial setup you should be able to access it normally using port 32400 on your servers public IP address

In Plex after adding the libraries these tweaks helped me a lot.

Under "Transcoder" and then "Show Advanced Settings" set the throttle buffer to 1200, select "Prefer Higher Speed Encoding" under Transcoder quality and disable empty trash automatically after every scan so you don't accidentally have to re-scan everything if rclone disconnects.