TrueNAS Nightly Development DocumentationThis content follows experimental nightly development software. Pre-release software is intended for testing purposes only.
Use the Product and Version selectors above to view content specific to a stable software release.
Adding a Google Photos Cloud Sync Task
11 minute read.
Google Photos cloud sync tasks in TrueNAS use the rclone backend for the Google Photos API to authenticate credentials and transfer data.
Configuring a Google Photos cloud sync task is a multi-part procedure where you:
- Plan your deployment and selecting a local dataset.
- Generate Google API credentials on the Google Cloud API dashboard.
- Install rclone and generate a token on your remote client OS.
- Add Google Photos cloud credentials on TrueNAS.
- Configure the cloud sync task on TrueNAS.
Review your storage and data protection requirements and consider your options before setting up a Google Photos cloud sync task. Refer to the rclone Google Photos backend documentation for more information on using rclone to sync Google Photos, including standard options and limitations of the Google Photos API, that might help you plan your deployment.
Consider how you want to manage your media files on Google Photos and in your local dataset. Decide on the cloud sync task direction and transfer mode, remote folder to target, and new or existing local dataset to pull to or push from, that best fit your needs.
A Google Photos cloud sync task can either pull files from Google Photos to a local dataset on TrueNAS or push local files to Google Photos. Select the direction that best fits the way you intend to manage your media files.
Choose to pull data from Google Photos if you prefer to manage media files via the Google Photos UI and use the local dataset as a backup target.
Choose to push data to Google Photos if you prefer to manage media files in the local dataset and use Google Photos as a cloud backup location.
Next, select the data transfer mode that best fits the way you want to manage file retention between the source and destination. There are three options:
- SYNC - Select to change files on the destination to match those on the source. If a file does not exist on the source, it is also deleted from the destination.
- COPY - Select to duplicate each source file into the destination. If files with the same names are present on the destination, they are overwritten.
- MOVE - Select to transfer files from the source to the destination and delete source files. Copies files from the source to the destination and then deletes them from the source. Files with the same names on the destination are overwritten.
After choosing the direction and mode for your cloud sync task, choose the remote Google Photos folder that rclone targets to sync data.
Because of the way rclone interacts with the Google Photos API, each target folder option has specific file management and structure requirements.
This is due to the way rclone interacts with the Google Photos API.
A cloud sync task cannot target the root level folder (
Folder | Recommended | Direction | Description |
---|---|---|---|
Yes | Push or Pull | Use this option for push tasks or if you prefer to organize the Google Photos library by sorting media files into one or more discrete albums. All files must be in distinct albums or child directories of the local dataset. Media files uploaded to Google Photos but not assigned to an album are not pulled to a local dataset mirroring | |
Yes | Pull | Use this option if you prefer to use the Google Photos library as single directory, without organizing media files into discrete albums. The local dataset of a | |
No | Push | Media files pushed from the local dataset to |
Select TrueNAS local dataset or create a new one to use as the source or destination.
Configure file management structure inside the local dataset (for push tasks) or albums in the Google Photos (for pull tasks) as required by your direction, mode, and target selections (see above).
On the Google API dashboard, click the dropdown menu to the right of the Google Cloud logo and select your project.
If you do not have a project, click NEW PROJECT and enter a value in Project name, Organization, and Location. Click Create.
After you select your project, click Enabled APIs & Services on the left menu, then click + ENABLE APIS AND SERVICES.
Enter photos library api in the search bar, then select Photos Library API and click ENABLE.
Click OAuth consent screen on the left menu, select EXTERNAL, then click CREATE.
Enter a value in App name and User support email.
Enter an email address in Developer contact information, then click SAVE AND CONTINUE.
Continue to the Test users section and click + ADD USERS, enter your email address, then click ADD.
On the OAuth consent screen, click PUBLISH APP under Testing and push the app to production.
Click Credentials on the left menu, then click + CREATE CREDENTIALS and select OAuth client ID.
Select Desktop app in the Application type dropdown, then enter a name for the client ID and click CREATE.
Copy and save your client ID and secret, or download the JSON file.
Download rclone for your client OS and open it in a command line utility following the rclone installation instructions. The example photos in this article use Powershell in Windows OS.
Enter rclone config
, then enter n
to create a new remote.
Enter a name for the new remote, then enter the number from the list corresponding to Google Photos.
Enter the client id and secret you saved when you created the Google Photos API credentials, then enter false
or press Enter to allow the Google Photos backend to request full access.
Do not edit the advanced config.
Enter y
to authenticate rclone using the web browser.
A browser window opens to authorize rclone access.
Click Allow.
In the command line, enter y
to confirm rclone uploads media items with full resolution and complete the configuration.
Copy and save the type, client_id, client_secret, and token, then enter y
to save the new remote.
In the TrueNAS Web UI, go to Credentials > Backup Credentials and click Add in the Cloud Credentials widget.
Select Google Photos as the Provider and enter a name.
Paste the Google Photos API client ID and client secret in the OAuth Client ID and OAuth Client Secret fields.
Paste your rclone token into the Token field.
Click Verify Credential to ensure the credentials are valid, then click Save.
Go to Data Protection > Cloud Sync Tasks and click Add. The Cloud Sync Task Wizard opens.
Select the Google Photos backup credentials from the Credentials dropdown list.
Click Verify Credential to ensure the credentials are valid then click Next.
Select the Direction as PUSH or PULL and select the Transfer Mode as SYNC, COPY, or MOVE. Select the Google Photos location to back up data to or from in Folder. Browse to and select the album folder or enter /album.
Select the local dataset in Directory/Files. This is the dataset sent to Google Photos for push tasks or the write destination for pull tasks.
Push tasks containing media files saved to the local dataset root level fail with the error: Failed to sync: can’t upload files here.
Save files to child directories, not to the root level of the TrueNAS dataset. Directories under the local dataset correspond to albums in the Google Photos library.
Enter a Description for the cloud sync task.
Select the time to run the task from the Schedule options.
Click Save to add the task.
TrueNAS adds the task to the Cloud Sync Task widget with the status Pending, until the task runs on schedule.
Click Dry Run to test the task by connecting to Google Photos and simulating transferring a file. During a dry run, TrueNAS sends or receives no data. A dry run can report successful even for a task that fails to transfer data due to misconfiguration
Click Run Job to start the cloud sync task immediately.
If a Google Photos cloud sync task fails, go to Data Protection and click the FAILED status in State on the Cloud Sync Tasks widget. Review the logged error message(s). Common error messages for failed Google Photos tasks include:
After reviewing available logs, click edit Edit on the task and review the configuration. Compare configured options to the requirements in Before You Begin above and correct any issues.
If a pull task is successful but some or all files are missing from the local dataset, review your library organization in Google Photos.
Pull tasks configured with