Cloud sync: google team drive

Smeghead

Cadet
Joined
Oct 28, 2020
Messages
6
First-time poster; long-time lurker.

I'm in charge of the FreeNAS machine that serves as the central file server in the lab for our little development team. We fall under the auspices of an .edu which grants us access to a locally-hosted google suite, including google drives that are theoretically of "unlimited" size. I've recently been asked to set up synchronisation between the bulk of our project files (totalling ~1.5TB, so not ridiculously massive) and a google team drive owned by our project lead to make sharing outside our little group a bit easier. However, for the life of me, I can't figure out what to set in the GUI to sync to a given team drive; so far I've only managed to copy small test subdirectories to the root of a general google drive.

Using the GUI, I've managed to sort out basic credentials. System / Cloud Credentials / Edit for the particular credential set shows "Google Drive" as the provider along with the long access token, and I've also filled out the alphabet soup ID for the team drive, all of which has been verified:

freenas team drive creds.png


However, I can't seem to turn that into a sync task that does what I want it to. Setting up a test sync in Tasks / Cloud Sync Tasks / Edit, I've given it a name (currently indicating I'm just testing), I've selected PUSH as a direction, selected the gdrive credential previously configured, and for my initial testing I'm just going with SYNC, as we haven't decided whether we want this just to be an read-only copy via google, or whether we want to allow changes there to propagate back to the lab.

However, with the credential that includes a team drive ID picked, the grey destination folder doodad does not show the contents of the team drive, but instead shows the general google drive's contents instead. Similarly, a test sync of a small subdirectory of files does not touch the team drive, but instead lands in a location relative to the root of the google drive. The UI looks like this:

freenas team drive sync resize.png


Am I missing a step/setting in the GUI? Is there something else I'm not understanding here?

The team drive ID is known to be correct; I have tested doing this manually with rclone from another (Linux) machine, and it works as expected. With the team drive id in rclone.conf on that machine, the destination is always relative to the root of the shared team drive, rather than the general google drive itself. While I could just run with that as a solution of sorts, I'd rather do this via the GUI if possible. Part of the reason why I chose FreeNAS years ago (along with pfsense as a router/firewall instead of the world's supply of iptables rules) is that if I were to get hit by a bus tomorrow, it would be far simpler for someone else to pick up the machine and continue to use it compared to some roll-your-own effort based on a general-purpose distribution. There's also something appealing to syncing directly from the host, rather than another system that has to schlep everything from a mount over the network to do the copy.

The system is currently on 11.3-U3.2. We're often an update or two behind; while we do have a backup, we don't have the resources for a failover setup and updates here require a fairly sizeable outage of a large part of the lab in general. The whole Covid mess has also meant that that a lot of planned updates have been put on hold for a while.

I believe the current version of 11.3 is U5, so I'm amenable to updating to that at some near point in the future if we're missing something relevant. However, I don't see anything via searches that suggests otherwise, and the docs don't really suggest that I do anything different.

If this is something that's known to be sorted out in TrueNAS 12.0, I haven't even started testing that yet, but if that's the way out in the longer term, then so be it.
 

Smeghead

Cadet
Joined
Oct 28, 2020
Messages
6
Doing some digging at the CLI level, my understanding of how this works in FreeNAS is sort of as follows:

When the sync task is run, something in FreeNAS' guts generates an rclone config script in /tmp, Going by the name, this is presumably generated with the likes of mktemp. This is then invoked with rclone as follows:
Code:
/usr/local/bin/rclone --config /tmp/tmp5jnuyvs_ -v --stats 1s --exclude .zfs --exclude .zfs/** sync /mnt/data/archive/gdrive_sync_test remote:/


This all seems reasonable enough for the options I picked in the GUI. My manual testing with rclone suggests that, so long as a shared drive ID is given in the config, specifying a destination of remote:/ should result in a copy to that shared drive.

The contents of the config fiel generated look as follows:
Code:
[remote]
token = <identical to token set in GUI>
team_drive = <identical to ID set in GUI>
client_id = <alphabet soup for some presumably unique API ID>
client_secret = <more gobbledygook to go with client ID>
type = drive
root_folder_id = root
folder = 
fast_list = False

The only difference I see here from my manual tests is root_folder_id = root. I haven't set that in my config, and that appears to be where the problem lies; when I set that in my manual testing, the shared drive ID is apparently ignored, and the result is the same as what I'm currently seeing from FreeNAS.

I'm trying to figure out what this config setting does. The docs for rclone config state:
ID of the root folder - leave blank normally. Fill in to access "Computers" folders. (see docs).
When I set the test environment up, I left this blank during rclone config as recommended.

The manpage says:
Root folder ID
You can set the root_folder_id for rclone. This is the directory (identified by its Folder ID) that rclone
considers to be the root of your Box drive.

Normally you will leave this blank and rclone will determine the correct root to use itself.

However you can set this to restrict rclone to a specific folder hierarchy.

In order to do this you will have to find the Folder ID of the directory you wish rclone to display. This will
be the last segment of the URL when you open the relevant folder in the Box web interface.

So if the folder you want rclone to use has a URL which looks like https://app.box.com/folder/11xxxxxxxxx8 in
the browser, then you use 11xxxxxxxxx8 as the root_folder_id in the config.
While it's still a little vague what setting this to root actually means, empirically the result is that it syncs to the root of my drive, rather than the specified shared drive.

My gut feel is that this is not desirable for syncing to a shared folder. Is there a setting to disable this anywhere in the GUI, or is this better served by opening a ticket?
 
Top