Backup Your Google Photos!

Sjoerd de haan
3 min readOct 29, 2023

--

Goolge Photos Logo
Goolge Photos Logo

You don’t want to lose your Google Photo’s.

Chances are low, but it happens people lose their photos.

Some people lose their account.
Someone I know lost here account three times last year, forgetting even the password of her business account.

Probably that does not happen to you.
But what if you lose your 2 factor authentication?

What happens if your phone number gets revoked somehow? Can you still access your Google account then then?

Even then…
There are stories…
Where Google lost content.
Where merger into a family account also delete all photos irrevocably.

If you feel this makes some sense, read this article about Tech Independence by Derek Silver. It mentions more reasons why you might want to take your data out of the cloud altogether. And why you want to apply this idea beyond photos.

Copying content with Rclone

Rclone is a command line tool for managing files on cloud systems, servers and locally.j

Rclone has two useful operations for backup: ‘copy’ and ‘sync’.

Copy just copies files, whereas sync mirrors two location.

Be careful with sync. If a file is absent in the source location, sync will remove it from the target location. In this way you can lose all your data.

Always run rclone with --dry-run first to see what it plans to do.

If you want to move your photos away from the cloud, then you can use the move operation.

Setup

Install rclone and run

rclone config

The CLI will guide you through the setup.

It is simple. Give the remote a clear name. Choose Google cloud from a list. Authenticate the CLI via the browser. That’s about it.

Mirroring with rclone sync

rclone sync makes the destination identical to the source:

rclone sync --interactive SOURCE remote:DESTINATION

It does not only copy, but also delete and modify files in destination.

Warning

For the initial backup, you want to copy your image library to an empty directory.

Suppose you interchange interchanging source and destination….

You sync your image library (destination) with your empty backup directory (source). The image library in the cloud will be updated to mirror the empty backup directory.

All images will be deleted. You will lose everything in your library.

How to prevent disaster

Beware: sync can cause data loss

Always run rclone sync with --dry-run first or use --interactive

Copying files with rclone copy

rclone copy is a less dangerous: it does not delete files from destination. It may still overwrite files on the target though.

This is the syntax for copy:

rclone copy --interactive SOURCE remote:DESTINATION

Backup of photos

This is how I make a backup of my photos:

rclone copy photos-sjoerd:media/by-day by-day/ -P  --tpslimit 5

-P to show progress
--tsplimit 5 to limit the transactions per second; a measure used by Google

Limit download rate

If you have a lot to download, you might hit one of the quota by Google.

error reading source directory: couldn't list files: Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute per user' of service 'photoslibrary.googleapis.com' for consumer xxx. (429 RESOURCE_EXHAUSTED)
2023-10-20 14:17:11 ERROR : by-day/2017/2017-01-04: error reading source

Here is more information about the Google Photos API: Library API overview and about isquota.

Incremental backups

You can use filtering for incremental backups.

To copy only content from the last two week, I use this:

rclone copy photos-sjoerd:media/by-day by-day/ -P - tpslimit 5 - max-age 2w

Resources

Rclone

Rclone copy

Rclone filtering

--

--

Sjoerd de haan

Improving life science research with machine learning. Physicist (PhD) and machine learning engineer.