Local incremental backups of Google Photos on Ubuntu with gphotos-sync
Published: 24-08-2020 | Author: Remy van Elst | Text only version of this article
'Google Photos' no longer syncs with
Google Drive or with their
Backup and Sync
desktop software. There used to be a checkbox to get your
Google Photos pictures
Google Drive but that has been disabled. I used that feature together
Backup and Sync tool to sync all the photos in
Google Photos to
my local Windows computer. From there I used
DigiKam to manage the photos
and backup them offline and offsite. Due to Google removing that feature, I had
to go find another way to get the pictures out of
Google Photos, which, after
a few months of (automated) use,
gphotos-sync on Ubuntu seems to be the best,
stable choice. In this guide I'll show you how to setup incremental backups
Google Photos on Ubuntu. My
DigiKam database moved over without problems,
and now I'm glad I don't have to use Windows for picture managemant anymore.
gphotos-sync describes itself as:
Google Photos Sync downloads your Google Photos to the local file system. It will backup all the photos the user uploaded to Google Photos, but also the album information and additional Google Photos 'Creations' (animations, panoramas, movies, effects and collages). It is only for Google Photos download / backup purposes. It cannot upload photos to Google Photos.
gphotos-sync is a command line python application that uses the Google Photos
API. Installation is not very complex since there is a
pip package. First make
sure you have
apt install python3-pip
python3 -m pip install gphotos-sync
Now follows a complex part on getting credentials. It's not as simple as just logging in with a username and password.
Google API authentication setup
The gphotos-sync manual has an up to date version of these instructions. At the time of writing this article they were working, but with Google you can never be sure what happens and when stuff is deprecated.
Start by going to console.cloud.google.com.
Create a new project. Name and location don't matter.
Go to console.cloud.google.com/projectselector2/apis/library, select your
new project, then select the
Photos Library API. Click the big blue Enable
Go to console.cloud.google.com/apis, select your project and go to
OAuth Consent Screen. Select
Fill in a name and click
In the menu bar, go to
Desktop Application and give the client a name. I used
You'll see a confirmation screen. Afterwards, use the download arrow button to
save the file as
I saved it in my
~/Downloads folder and then moved it to the correct folder for
gphotos-sync, creating it if it does not exist:
mkdir -p ~/.config/gphotos-sync/ cp ~/Downloads/client_secret.json ~/.config/gphotos-sync/client_secret.json
Once you login to Google you might get an 'Unverified' warning, which, in this case, is fine.
After this, rather complex process, you can start using the software.
Create a folder where your pictures are going to be synced to:
mkdir -p ~/gphotos-sync/
Also authorize the client, it will ask you the first time you sync:
gphotos-sync ~/gphotos-sync/ --progress 08-23 14:10:31 WARNING gphotos-sync 2.14.2 2020-08-23 14:10:31.372785 Please go here and authorize, https://accounts.google.com/o/oauth2/v2/[...] Paste the response token here:
It will tell you the application is not verified by google, which we know because we just created it. In this case that is fine. I received a few emails after logging in from Google as well, which is nice.
You only need to do that the first time you sync.
Now, you can just sync with the following command:
gphotos-sync ~/gphotos-sync/ --progress
08-23 14:12:24 WARNING Indexing Google Photos Files ... 08-23 14:13:56 WARNING Listed 80 items ... 08-23 14:17:38 WARNING indexed 100 items .. 08-23 14:17:38 WARNING Downloading Photos ... 08-23 14:19:07 WARNING Downloaded 90 items ...
I like to have interactive progress, but you can omit the parameter if you are
using cron or a script. Logging will be done to a file instead of
Your pictures will be in
The next time you sync, only new photos will be downloaded. The tool is not able to detect changed photos, due to API limitations, so changes will not be detected. It will also not delete local pictures,Tags: backups , debian , google , google-photos , gphotos-sync , photos , privacy , python , tutorials , ubuntu