Windows 10 Google Drive Rclone set up. (For Plex Media Center)

Hi there!
First off, @ncw thank you for Rclone, and thanks to all the contributors.

I’ve spent the last week setting up a new PLEX server with Google Drive for storage using Rclone. I documented my set-up as I went and thought I’d post it in case it helps anyone else and for any feedback on how I might optimize anything. (or just so anyone can point out any noob mistakes I’m making)

Overview
Use Case:
I have a NUC (Windows 10), running Radarr, Sonarr and PLEX Server. NAS For local back up and Media Storage. Offsite back-up with Crashplan.
Want to add cloud storage (Gdrive) to meet two needs:

  1. Additional storage capacity/offsite backup for media
  2. Offsite backup for NUC and other devices (to replace Crashplan)

Additional Goal:
I have movies/TV in my collection that would be difficult to replace. I envisage most media in the cloud, but retaining a local copy of that “important” collection. All of that will be seamlessly presented to PLEX.

High Level workflows
Media:
Sonarr / Radarr run on the NUC and download to the NAS. Overnight scripts will copy to Gdrive.

A Rclone union will present PLEX with a single drive containing the onsite/gdrive media.

I’ll manage local storage capacity manually (for now). i.e. I’ll manually delete local stuff (I don’t want a local backup of) as and when.

Backup:
I use Syncredible to backup files/Windows Image from Devices to the NAS (Everything backed up weekly, but staged over a full week. i.e.backup is broken into seven parts and one part is done each night) overnight scripts will sync to Gdrive

RClone Config, In my case is something lilke:

Drive Remote - Gdrive:

Crypt Remote Media_vfs: (for my Media storage)

Crypt Remote Backup_vfs: (for my Backups storage)

Union Media_Union (Union of Media_vfs: and my local media storage)

Disk / Drive view:
disk_drive

Media / Backup workflows Overview:

Instructions

Set up Rclone with VFS

Create ClientID on GoogleDrive:
Create a client ID on GoogleDrive API. I followed the guidance here: https://www.iperiusbackup.net/en/how-to-enable-google-drive-api-and-get-client-credentials/

Install and set up Rclone:

  1. Create C:\Program Files\rclone.
  2. Download rclone from http://rclone.org/downloads/ and unzip it to C:\Program Files\rclone

Configure Rclone:
There are lots of other excellent guides that step throug the config.I won’t do step by step here. My Config file ended up like…

[Gdrive]
type = drive
client_id = *redacted*.apps.googleusercontent.com
client_secret = *redacted*
scope = drive
token = *redacted*

[Media_vfs]
type = crypt
remote = Gdrive:Media_Storage_crypt
filename_encryption = standard
directory_name_encryption = true
password = *redacted*

[Backup_vfs]
type = crypt
remote = Gdrive:Backup_Storage_crypt
filename_encryption = standard
directory_name_encryption = true
password = *redacted*

[Media_union]
type = union
remotes = Media_vfs: V:\

Notes:

  1. Only the last remote is used to write to and delete from, all other remotes are read-only.
  2. The V: Drive here should be F:. F: is the drive my local media is mounted on (my NAS). BUT I’m going to start the UNION under a service. The service uses the SYSTEM Account and F: is only visible from my account (thanks Windows!). I will explain how to create the drive V: later on.

Automate the union mounting using NSSM.
Great. I have my remotes. I want them to Mount two of them (Backup_vfs: & Media_Union:) at Boot up. I’m going to use NSSM for that.

General Guidance here:
https://nssm.cc/usage
https://forum.rclone.org/t/how-to-propery-setup-rclone-mount-on-windows-using-nssm-as-a-service/7055
& https://forum.rclone.org/t/installing-rclone-mount-on-windows-as-service/4649

How to Run NSSM:
Copy nssm.exe to same directory that rclone is in. Launch NSSM, by opening an elevated command line. (Type cmd in the search bar and right click and choose “run as administrator.”). Then type

  1. cd c:\rclone (or wherever you have rclone located)
  2. nssm install “Service Name Here”
  3. Fill in the info below
  4. Still in the command prompt, type services.msc
  5. Scroll down and choose your service and right click and start it.

IF it fails to start, stop the service.
Go back to command prompt and run sc.exe delete “Service Name Here”
Enter the command from step 2 above and repeat until you complete everything with no typos and it works.

NSSM settings:

NSSM Settings Backup_vfs:
Service Name = Rclone Backup_vfs Mount Google Drive
Application tab:
Path: c:\Program Files\rclone\rclone.exe
Startup Directory: c:\Program Files\rc- lone
Arguments: mount Backup_vfs: --vfs-cache-mode writes --dir-cache-time 72h N: --config "C:\Users\robev\.config\rclone\rclone.- conf"
Service name: Rclone Backup_vfs Mount Google Drive
Details tab:
Display name: Rclone Backup_vfs Mount Google Drive
Description: Automatically mounts the encrypted google drive using rclone. Encrypted drive is Backup_vfs local drive is N:
Exit actions tab:
Delay resart by: 10000 ms (10 seconds)

NSSM Settings Media_Union:
Service Name = Rclone Media_Union Mount Google Drive
Application tab:
Path: c:\Program Files\rclone\rclone.exe
Startup Directory: c:\Program Files\rc- lone
Arguments: mount --allow-other --dir-cache-time 72h --drive-chunk-size 64M --log-level INFO --vfs-read-chunk-size 32M --vfs-read-chunk-size-limit off Media_union: H: --config "C:\Users\robev\.config\rclone\rclone.conf" --vfs-cache-mode writes
Service name: Rclone Media_Union Mount Google Drive
Details tab:
Display name: Rclone Media_Union Mount Google Drive
Description: Automatically mounts the encrypted google drive using rclone. Encrypted drive is Media_union local drive is H:
Exit actions tab:
Delay resart by: 10000 ms (10 seconds)

Note: To change the parameters of NSSM / rclone after creation of the service, use regedit.exe to edit the registry:
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RCLONE SERVICE NAME\Parameters

Creating the V: drive (for the Media_Union Remote)
Why do I need to create a V: drive? What I want is a union Media_vfs: and my Local Media storage (f:). BUT I’ve set up Media_Union H: to start as a service (using NSSM above).

Problem, in my use case, is the local drive, (f:) is a share drive. Share drives are only visible to the user who creates them (in this case my user account). However, the service, I’ve created, uses the SYSTEM Account so F: is NOT visible to it. (the service still creates Media_Union H: for me, but only the gdrive content is visible!

The workaround for this …
Create, another mapping of my Local Media storage (f:). In this case as drive V:
Specifically use task schedular to create V: on startup, under the SYSTEM user, and will be visible to my Media_Union.

Open cmd (with admin privs) amd type :

schtasks /create /tn "my_mount" /tr "net use V: \hostname\directory /persistent:yes" /sc onstart /RU SYSTEM /RL HIGHEST

Followed by a restart of your server
• or by executing: schtasks /run /tn “my_mount”
• or going to Task Scheduler and starting the task from there.

IF your share needs credentials add “/user:device\username Password
IF your share is mounted already Windows may tell you you can’t have two users use the same credentials. It did for me and I got around it by using the device IP rather than the name.

Example:
schtasks /create /tn "my_mount" /tr “net use V: \\192.168.1.99\SeagateNAS\Storage /persistent:yes /user:PERSONALCLOUD\username Password /sc onstart /RU SYSTEM /RL HIGHEST

Notes:
The workaround shows the V: drive in My Computer (This PC). BUT as a “disconnected Network Drive”. However, it’s not caused me problems other than aesthetics.

Note: IF there are problems with the service running before the task at boot up. I had problems on 1 reboot, but all the rest have been fine. But still try the advice here: https://stackoverflow.com/questions/30331462/boot-order-on-windows-services-vs-scheduled-tasks

At this point I can re-point PLEX at the drive H: (Media_Union) and Sonarr/Radarr at the same. (following all the good practice on repointing PLEX over on the PLEX forums)

Setting up automated copy/Move/Syncs for Rclone
I’ve not set up the back-up scripts (yet) but intend to use the following commands:

Copy Media from NAS F: (storage) to Gdrive G: (Media_vfs)

"C:\Program Files\rclone\rclone.exe" --config C:/Users/robev/.config/rclone/rclone.conf copy --verbose --transfers 4 --checkers 8 --log-file="C:\Users\robev.config\rclone\Rclone_Log_Files\Media_vfs.txt" --fast-list --max-backlog=100000 --tpslimit=10 \PERSONALCLOUD\Storage Media_vfs: --dry-run

Sync (backup) from NAS M: (Backup) to Gdrive N: (Backup_vfs)

"C:\Program Files\rclone\rclone.exe" --config C:/Users/robev/.config/rclone/rclone.conf sync --verbose --transfers 6 --checkers 8 --log-file=C:\Users\robev.config\rclone\Rclone_Log_Files\Backup_vfs.txt --fast-list --max-backlog=100000 --tpslimit=10 \personalcloud\Backup Backup_vfs:NUC_Backup --exclude "/WindowsImageBackup/**" --dry-run

remember to run with --dry-run first and check all is good before running properly!!

Edits:

  1. Updated Copy and Sync commands.
  2. Updated Union mount parameters.
5 Likes

Hope this is helpful to someone!

Would love any feed back on these Commands:

Union mount command (used by Radarr/Sonnar to write to. And used by PLEX)

rclone mount --rc --allow-other --buffer-size 1G --dir-cache-time 72h --drive-chunk-size 256M --fast-list --log-level INFO --vfs-read-chunk-size 32M --vfs-read-chunk-size-limit off Media_union: H: --poll-interval 1m --config “C:\Users\robev.config\rclone\rclone.conf” --vfs-cache-mode writes

Copy Media from NAS F: (storage) to Gdrive G: (Media_vfs)
"C:\Program Files\rclone\rclone.exe" --config C:/Users/robev/.config/rclone/rclone.conf copy --verbose --transfers 4 --checkers 8 --log-file="C:\Users\robev.config\rclone\Rclone_Log_Files\Media_vfs.txt" --fast-list --max-backlog=100000 --tpslimit=10 \PERSONALCLOUD\Storage Media_vfs: --dry-run

Sync (backup) from NAS M: (Backup) to Gdrive N: (Backup_vfs)

"C:\Program Files\rclone\rclone.exe" --config C:/Users/robev/.config/rclone/rclone.conf sync --verbose --transfers 6 --checkers 8 --log-file=C:\Users\robev.config\rclone\Rclone_Log_Files\Backup_vfs.txt --fast-list --max-backlog=100000 --tpslimit=10 \personalcloud\Backup Backup_vfs:NUC_Backup --exclude "/WindowsImageBackup/**" --dry-run

after some twiddling I’ve updated the Copy and Backup commands, seem to work better/Quicker for me.

Copy Media from NAS F: (storage) to Gdrive G: (Media_vfs)

"C:\Program Files\rclone\rclone.exe" --config C:/Users/robev/.config/rclone/rclone.conf copy --verbose --transfers 4 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --log-file="C:\Users\robev.config\rclone\Rclone_Log_Files\Media_vfs.txt" --fast-list --max-backlog=100000 --tpslimit=10 \PERSONALCLOUD\Storage Media_vfs: --dry-run

Sync (backup) from NAS M: (Backup) to Gdrive N: (Backup_vfs)

"C:\Program Files\rclone\rclone.exe" --config C:/Users/robev/.config/rclone/rclone.conf sync --delete-after --verbose --transfers 6 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --log-file=C:\Users\robev.config\rclone\Rclone_Log_Files\Backup_vfs.txt --fast-list --max-backlog=100000 --tpslimit=10 \personalcloud\Backup Backup_vfs:NUC_Backup --exclude "/WindowsImageBackup/**" --dry-run

You probably don’t need to adjust the backlog. Both timeouts can also be removed as they are at the default anyways. Save with both retry parameters.

1 Like

Thanks @calisro.

I’d copied some of that from rclonebrowser or someone else’s suggestions. But checking on the wiki I have a couple of default values called out ( --delete-after, --timeout, – contimeout, --retries and --low-level-retries). I’ll remove them.

Are there any situations/reasons I’d want to be explicit about values that are defaults anyway?

nope. If they are default, no need to specify. Be careful copying other people’s commands. We see lots of mistakes being propagated. More aren’t really impacting (like --fast-list on a mount) but it complicates things for you.

1 Like

Appreciate the feedback.

Wow awesome write up. Definitely going to be using a lot of this information in my own set up. A few questions, how would you say the performance of this set up compares to either local drives or rclone vfs on Ubuntu if you tried it? Like start up times or how many simultaneous streams you can do? Thanks for the post!

@kimsbrian cheers.

Regards performance I can't compare to Ubuntu. Compared to local drives, guess two scenarios (keep in mind I have a local NAS and the gdrive presented to plex via a union)
1)File is on the local disk: no noticeable performance drop.
2) file in on gdrive: there is a tiny bit of lag. It's noticeable (to me, I suspect my wife and kids are oblivious) but we're talking a second to buffer. Search (fast forward) through a film and it's a little more telling. But it's still a very solid user experience.
All my material is in 720 or 1080. For 4k your milage might very. But, I've tested with 4k, high bit rate files, and it's worked fine.

Ref simultaneous streams. I've never gone past 2, that's one directly connected TV and one to mobile/tablet. But it didn't bat an eyelid.

The only nagging issue I have the union sometimes flakes out. Mainly if I delete files. That is as easy to fix as restarting the service. I've got a scheduled task that does it overnight and I think I've had to do it manually once since. I have a .bat on the desktop to restart the service so it's a oneclick thing anyway.

If there is a specific usecase you have in mind I don't mind testing it for you.

2 Likes

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