Shared Drive Not Found with Service Account

I would like to use Service Account (SA) when copying from Team Drive to My Drive (in same Google Drive account). It successful without SA, but error "Shared Drive not found" if added SA.

What is the problem you are having with rclone?

The script not working when I add Service Account file argument

What is your rclone version (output from rclone version)

1.51

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10, 64bit

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy "gdteamdrive:" "gdmydrive:"  -v -P --transfers 12 --drive-server-side-across-configs --drive-service-account-file=1.json

The rclone config contents with secrets removed.

[gdyesmydrive]
type = drive
scope = drive
token = {"access_token":"xxxxx"}
client_id = xxxxxx.apps.googleusercontent.com
client_secret = xx-xx
root_folder_id = 0AIUTxF2qshJ8Uk9PVA

[gdteamdrive]
type = drive
client_id = xxxxx.apps.googleusercontent.com
client_secret = xx-xx
scope = drive
token = {"access_token":"xxxxx"}
team_drive = 0AGIWppWTSgefUk9PVA

A log from the command with the -vv flag

ERROR : : error reading source directory: failed to get Team/Shared Drive info: googleapi: Error 404: Shared drive not found: 0AGIWppWTSgefUk9PVA, notFound
2020-05-20 00:11:28 INFO  : Google drive root '': Waiting for checks to finish
2020-05-20 00:11:28 INFO  : Google drive root '': Waiting for transfers to finish
2020-05-20 00:11:28 ERROR : Attempt 1/3 failed with 1 errors and: failed to get Team/Shared Drive info: googleapi: Error 404: Shared drive not found: 0AGIWppWTSgefUk9PVA, notFound

Your challenge is that each service account is similar to a "free" gmail user. It has its own storage quota, which sadly is only 15GB in My Drive.

When you copy a file into My Drive that file is owned by the service account, not your main account. And you hit the 15GB limit fairly quickly. Also, you can end up with orphaned files (no owner) if the service account gets deleted in future - which has its own set of problems.

You don't run into this copying to team/shared drives with service accounts because the ownership and quotas sit with whatever G Suite user created the TD, not the account that copies the files in.

Another approach is to use service accounts with --drive-impersonate. But that doesn't give you any real benefit as the quotas used with --drive-impersonate are the ones from your main account (so might as well just use that main user account).

===

An ugly but working solution is to create a mirror team drive. Then if you want to keep a backup in My Drive use a script to move differential files from the mirror, as server side moves do not use quota.

Thanks for replying. This Google account is a Gsuite Business. Is it still tag with issue of "free" gmail user of 15GB storage in My Drive?

Sadly, yes. The service accounts are in their own category. Would be easier for all of us if they were viewed as sub-accounts of the main user.

This is one of a number of scripts that might help you toward where you want to go:

1 Like

I'm abit reserve on this, since this can be archived by using AutoRclone. The only difference that it uses to copy Team Drive to Team Drive.

I think this is the nearest that I can relate on with Google Service Account: Service account not allowing to see files and folders

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