Skip to content

Instantly share code, notes, and snippets.

@michaelbutler
Last active June 10, 2023 22:53
Show Gist options
  • Save michaelbutler/f7bb33d2b04e1e6547bb120642a417ad to your computer and use it in GitHub Desktop.
Save michaelbutler/f7bb33d2b04e1e6547bb120642a417ad to your computer and use it in GitHub Desktop.
Copying and Backing up Google Photos to BackBlaze

Copying and Backing up Google Photos to BackBlaze

BackBlaze offers data backup to the cloud for just a few cents per gigabyte. So, when I had almost reached my 100 GB limit on Google Photos (Google One), I decided to tranfer it all to a local 4 TB hard drive and then put a second backup into the cloud for long term storage.

The process was not that easy, so if you have any better advice please let me know. Here is what I did:

Getting the Photos to Local Machine

I had about 65 GB of photos and videos on Google Photos I wanted to download, spanning thousands of files and multiple years. It would take far too long to do it in the browser so I went to Google Takeout in hopes it would be faster.

Google Takeout: https://takeout.google.com

Choose the button to request an export of your data.

At the top click deselect all apps. Then, scroll down and only check off Google Photos (this includes videos stored in Google Photos).

Choose a single one-time backup. Now choose your desired file format and file size. I am on Linux so I went with .tar.gz (.tgz) and 4 GB chunks. In hind sight, I had so much data I think 10 GB chunks would have been better as it meant fewer files to deal with.

Click submit, then wait a while until you get an email. Mine took about 1 hour to arrive.

Downloading the Zip Files

Here comes the annoying part. I don't know of a faster way to do this, but I had to click download on each of the file chunks to start the download process. I decided to download three at a time (I'm on a 300 MBit connection) since each file was 4 GB. There's an annoying limitation here where you have to re-enter your Google password quite frequently, so every 5 minutes when I wanted to start the next 3 chunks, Google prompted me with the login form again!

Extracting to External Hard Disk

This step is optional. I wanted to have the photos more ready for viewing on my computer, and I'm on Linux, so I ran this tar command to exact all the files in one shot:

mkdir -p /run/media/bmike/USB3/Backup/Google_Photos
for file in *.tgz; do tar -zxf "$file" --directory "/run/media/bmike/USB3/Backup/Google_Photos" --one-top-level; done

This put all of the data into my external USB drive. There is probably some better flags to choose there, because the way I ran it put each extracted data set into a unique folder, so I ended up with about 30 folders. But I can always re-organize them later with the "merge" feature of KDE's Dolphin file explorer.

Copying to BackBlaze

I logged in to my BackBlaze account and created a new bucket. Next, I created a new App Key (left sidebar). A copied down the secret key information so I could reference it later.

Then I installed the backblaze CLI program. I put it in my $PATH and ran chmod +x b2 on it so I could execute it.

First authenticate with the utility by running:

b2 authorize-account

Enter your credentials when prompted (the AppKey stuff).

Finally, navigating to the directory with all of my .tgz files (because I opted to just backup the google .tgz files and not the individual loose photos), I ran this command:

cd /path/to/tgzfiles
for file in *.tgz; do b2 upload-file bucket-name "$file" "$file"; done

Be sure to replace bucket-name with your backblaze bucket name.

Sit back and relax as your archives get uploaded!!

Deleting from Google Photos

Now that the files are both on your computer drive and in BackBlaze, you are safe to delete them from Google Photos!

This section is to be written further.

@michaelbutler
Copy link
Author

[1st Comment Slot Reserved]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment