Rclone is a command-line program to manage files on cloud storage. It is a feature-rich alternative to cloud vendors’ web storage interfaces. Over 40 cloud storage products support rclone including S3 object stores, business & consumer file storage services, as well as standard transfer protocols.
Users call rclone “The Swiss army knife of cloud storage”, and “Technology indistinguishable from magic”.
Over time your Plex library can grow to extraordinary sizes, especially if you value a decent quality of your movies and series. The first intuitive solution would be to grab a decently sized storage VPS and mount it’s drive to our Plex server over NFS or perhaps SSHFS. The problem is that storage VPSs usually have a second, if not third-tier networking. With multiple users trying to fetch different movies you might also hit a CPU cap, especially if you encrypt the data stream (SSHFS or NFS over encrypted VPN).
At some point, you might hit the magic barrier of 10€/mo for storage at which point a storage server is no longer cost-effective, as unlimited space can be achieved under the threshold of 10€.
Google offers unlimited Drive space in its GSuite Business service. In some regions it outright says unlimited, but in most regions the description states “or 1TB per user if fewer than 5 users”, however, it’s a well-known industry secret that Google has never enforced that restriction and probably won’t do that in the near future. If you are still unsure about your data safety - Google always downgrades (be it student plan or paid plan) accounts in a non-destructive fashion. You still have the access to all your files, you just can’t upload any more.
Rclone provides a one-line installation script:
curl https://rclone.org/install.sh | sudo bash
You can also go to rclone.org/downloads if you want to go the more traditional way and install the package manually.
The best practice is to obtain our own Google Drive API key as rclone’s default key is shared among its users. There is a global rate limit on the number of queries per second that each key can do set by Google. Rclone has a high quota and is working with Google to keep it high enough, however, we are power users here, aren’t we?
- Log into the Google API Console (the account doesn’t matter).
- Select a project or create a new one.
ENABLE APIS AND SERVICESon the top, search for
Google Drive API
- Now go to
Credentialson your left-side panel
- Proceed to create an OAuth Client ID by pressing
CREATE CREDENTIALSon top.
- If you haven’t previously created a consent screen go ahead and configure it now (choose external, you do not have to audit it). All you have to set is the name. After creating the consent screen try to create the OAuth credentials.
- For the
TVs and Limited Input devicesand enter any name you desire.
- Keep the Client ID and Secret around (you can always access it by pressing the pen icon next to the credential).
Start by executing
No remotes found - make a new one
n for new remote and give it a name (make it memorable)
After entering the name you will be presented with a list of all available remote types, we are interested in
XX / Google Drive
Now it’s time to enter your client ID and secret.
Google Application Client Id
Now choose a scope:
Scope that rclone should use when requesting access from drive.
If you want to restrict rclone to a specific folder inside your drive you can enter
root_fodler_id in the next step. You can get the folder ID from URL when accessing Drive in the browser. For example from
https://drive.google.com/drive/u/1/folders/1xDLZTo0x1kOJLXke9mUqe3l8EiUXXXXX, we obtain
1xDLZTo0x1kOJLXke9mUqe3l8EiUXXXXX. This also works with folders inside team drives.
For the sake of later convenience, I suggest creating a folder if you haven’t done it previously.
ID of the root folder - leave blank normally. Fill in to access "Computers" folders. (see docs).
Next, you will be asked for Service Account Credentials. These are useful for using rclone in unattended mode (i.e. not tied to a specific end-user Google account); …or when you want to bypass the 750GB daily upload limit. However service accounts are beyond the scope of this tutorial, so we leave the field empty.
…also, we are not interested in advanced config so skip that part too.
Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
In the next step, we have to give rclone permission to use our Google Drive. If you are on a desktop machine enter
y; if you are on a remote or headless machine enter
Depending on what have you chosen, either a browser will open and rclone will obtain the code automagically or you will be given a link to Google’s OAuth page - after you grant the access you will be given verification code, paste it in the console.
Now rclone will ask if you want to use your main drive or a team drive. The decision is up to you.
Configure this as a team drive?
The last step is to confirm if our configuration is OK
…and we are done! We can technically now mount the drive, but since we are going to use the drive for storing movies for Plex let’s proceed with some tweaks.
Since you are now familiar with the rclone configurator there is no need to go through it for another two remotes. We will edit the
rclone.conf straight away to save some time. You should have no problems understanding the syntax.
Do not loose
: after parent remote!
The only param we are now missing is obviously the encryption password and salt.
DO NOT SKIP THIS PART
To add the encryption password and salt we once again execute
rclone config and we edit the crypt remote:
To check if our configuration is working we can execute
rclone mount and try to access the mount in another terminal/SSH session. As with any mount, make the directory earlier. The following arguments for rclone are best suited for Plex and come from my own trial and error.
If our configuration is working we can proceed and make a simple service. Remember about the
--config - point it to your config.
You can now head to Plex and add your mount.
If you want to use the same mount on another machine and have your file decrypted all you have to do is to copy the
rclone.conf to the new machine.