Google Photos has long been a convenient and powerful tool for storing and managing your photos and videos. However, recent changes to Google Photos’ integration with Google Drive have made it more challenging to back up your photos to a local computer or NAS system. If you’re like me and want to ensure that your precious memories are safely stored on your local network, this guide will walk you through the process of backing up your Google Photos library to your Unraid server. While this guide is specific to Unraid, the same concepts can be applied to other systems.
For a while now, I’ve seen different solutions that replace Google Photos with self-hosted options that have mobile applications for syncing from your phone. However, these solutions were never appealing to me for several reasons:
- Shared Albums: Moving away from Google Photos would require convincing everyone around me to switch as well. I have shared albums created by others that I want to continue accessing, and I want others to join albums I create.
- Years of Photos: I have many years of photos and videos already backed up on Google Photos. I don’t want to split my library between old photos on Google Photos and new ones elsewhere.
- NAS Connectivity: My home NAS is blocked from the internet, and I don’t want to open it up just to sync photos. Additionally, I don’t want to only sync photos when I’m home.
While Google Photos remains a convenient and powerful tool for managing photos on your phone, the removal of its integration with Google Drive in 2019 has made local access and backups more challenging. This guide offers a solution that allows you to continue enjoying the benefits of Google Photos while ensuring a full backup of your photos to your Unraid NAS. The process complements your use of Google Photos rather than replacing it, giving you both convenience and control over your digital memories.
Step-by-Step Instructions
We’ll be setting up a component called gphotos-sync
, an open-source tool that allows you to download your Google Photos to your local storage. Here’s how to do it:
- Stop Conflicting Applications: If you already have another apps (Docker container) using port 8080, 3000, or 3001, stop them temporarily. You’ll be able to re-enable them later.
- Authenticate with Google Photos: You need to create an authentication with Google Photos to allow
gphotos-sync
to access and download your photos. Follow the instructions here to the letter. - Create Folders on Your NAS: Create two folders on your NAS: one for the configuration files and one for storing the downloaded Google Photos. Rename the
client_secret.json
file you obtained in the previous step and place it in the configuration folder. - Add a New Docker Container in Unraid:
In Unraid, go to the “Docker” tab, and at the bottom of the screen, click on the “Add Container” button.- Template: Ignore this field; don’t select anything.
- Name: Set this to “GooglePhotosSync.”
- Repository: Enter
ghcr.io/gilesknap/gphotos-sync
. - Network Type: Select “Host” to ensure proper network access.
Next, you’ll need to map the necessary ports and paths: - Click on “Add another path, port, variable, label.”
- Select Port: Enter
8080
for both the container port and host port. This port is crucial for the application’s interface. Note that if another app is using this port, you’ll need to temporarily stop that app. - Click “Save” to continue.
- Select Port: Enter
- Click on “Add another path, port, variable, label.” again.
- Select Path: Under “Container Path,” type
/storage
. Under “Host Path,” choose the folder where all your Google Photos will be stored on your NAS. For me, it was/mnt/disk1/Google-Photos/
. - Click “Save” to continue.
- Select Path: Under “Container Path,” type
- Click on “Add another path, port, variable, label.” once more.
- Select Path: Under “Container Path,” type
/config
. Under “Host Path,” choose the folder where the configuration files will be saved on your NAS. For me, it was/mnt/cache/appdata/gphotos-sync/config/
. - Click “Save” to continue.
- Select Path: Under “Container Path,” type
- Finally, click on “Advanced View” in the top right corner of the screen. You’ll now see more options. Find “Post Arguments” and type
gphotos-sync
. This tells the container to run the sync process. - Click “Apply” to create your application.
[See screenshots below for my own settings]
Once the application is running, you’ll need to authenticate it with Google Photos. You’ll see a URL in the logs on the screen, which you’ll need to visit to complete the authentication process. This step is critical and requires using a web browser on the Unraid system itself.
Since you can’t access this URL directly from your regular computer, you’ll need to install a web browser on Unraid. Here’s how:
- Authorize the Application:
- Go back to the “Apps” tab in Unraid, and search for “Firefox.” You’ll find several versions available; any of them should work fine.
- Click to install the Firefox Docker container. Before completing the installation, make sure to set the Network Type to “Host” to ensure proper network functionality.
- Once installed, launch the Firefox application from Unraid by clicking on the Firefox icon and selecting “WebUI.” This will open a browser window within your browser, effectively running Firefox inside Unraid.
- To authenticate the GooglePhotosSync container, copy the URL from the logs and paste it into the Firefox browser within Unraid. If you encounter difficulties with copying and pasting (as I did), consider emailing the URL to yourself and opening your email within the Firefox browser (Found a better solution for copying into Firefox? Let me know!)
- Run the Initial Sync:
- After following the authentication steps on the Google Photos page, return to the Unraid logs. The logs should confirm that you are now authorized, and the sync process will begin, copying all your photos, albums, and shared albums into well-structured folders on your NAS.
- Clean-up
- After everything is done running, you can safely remove the Firefox installation, you will not be needing it anymore, and remove the Port allocation from the GooglePhotosSync app, it will also not be needed moving forward, we only used it for the initial authorization.
- Set Up a Scheduled Sync:
- To set up a scheduled sync for your Google Photos backup, start by installing the “User Scripts” plugin from the Unraid Apps tab. This plugin allows you to automate tasks on your server. Once installed, navigate to the “Plugins” tab and open “User Scripts.” Click “Add New Script” to create a new script that will re-sync your photos on a regular schedule. In the script editor, paste the provided code snippet below to initiate the sync process. The code snippet already points to the correct folders you configured earlier. After saving the script, you can set a schedule from the dropdown menu, choosing how often you’d like the sync to occur—whether it’s daily, weekly, or at a custom interval. This ensures your Google Photos are regularly backed up to your NAS without manual intervention.
Here’s the script:
#!/bin/bash
echo "Starting Google Sync Process"
docker exec -i GooglePhotosSync gphotos-sync --log-level info --logfile /config/gphotos.log /storage
echo "Google Sync Process Ended"
Unraid Settings Sceenshots
Enjoy Your Backed-Up Photos:
- Now that your Google Photos are safely backed up to your NAS, you can take full advantage of having your photos locally stored. One of the great benefits is setting up your backed-up photos in Plex. By defining your photo library in Plex, you can access and view your photos on any TV or device connected to Plex, anywhere in your home or remotely. Additionally, these photos can be used as wallpapers and screensavers on your TV, providing a personalized touch to your home entertainment system. If you’re an Apple TV user, this solution is particularly valuable since there’s no built-in Google Photos app for Apple TV. By using Plex or similar applications, you can now easily display your photos on your Apple TV, making this setup an excellent alternative to the lack of direct Google Photos support. This way, you can enjoy your photos across all your devices, regardless of platform, with the added security of knowing they’re safely backed up on your NAS.
Summary:
Backing up your Google Photos library to a local NAS, specifically using Unraid, is a reliable way to keep your photos safe and accessible. By setting up gphotos-sync
and using a Docker container on Unraid, you can automate the backup process and ensure your memories are securely stored on your local network.
Special thanks to the following sources of information for helping me succeed with this project [1] [2]