I take a lot of pictures. up until recently I just downloaded them manually into my computer. but following the tech trends I have moved to uploading my phone photos to the google photos cloud.
to be honest, I trust google engineers to do better job than me in backing up thier servers and making sure I don’t loose all those memories. but still I wanted to hace a local copy.
I’ve upgraded my home server to FreeNAS and thought it was a great operatunity to use it’s cloud backup options, when google threw an unexpected surprise. they are splitting up google photos and google drive, which was the only way to access these photos from another server.
So I’ve dug the internet and found a great script called gphotos-sync which does “Google Photos and Albums backup with Google Photos Library API”. cool ! It uses the direct photos API so no need for the drive-photos link. I’ve made a few tweeks (now part of the official repository) to the code, so I can still use my current directory structure (which was created by good old but deprecated picasa 3)
Next task was making it work as a scheduled task on FreeNAS. While I am a savvy user of many OS’s, I’m quite new to FreeNAS so maybe there is a nicer way to do it, and you’re encouraged to leave comments below. But here’s what worked for me….
I’ve created a new jail, dubbed “cronjail”, installed gphoto-sync as per it’s instractions and mounted my shared picture pool in
/mnt/pictures. Next I’ve wrote the following script:
cd /root/gphotos-sync pipenv-3.6 install pipenv-3.6 run /root/gphotos-sync/gphotos-sync --skip-albums --use-flat-path --db-path=/mnt/pictures/_db --logfile=_db/gphotos.log --photos-path= /mnt/pictures/ > /root/log1.txt pipenv-3.6 run /root/gphotos-sync/gphotos-sync --skip-albums --use-flat-path --db-path=/mnt/pictures/_db2 --logfile=_db2/gphotos.log --photos-path= /mnt/pictures/ > /root/log2.txt
The first two lines are to avoid error messages I got when running the script. Again, I’m new to all this jail business.
Then I run gphotos-sync twice: one for my account, and one for my wife’s. So two account secrets and two databases If you only got one account and OK with the nested YYYY/MM directory structure, you can simplify the other parameters.
Last thing is to schedule the script regularly. Go to Tasks->Cron jobs and add a new job with the command
jexec 6 /root/gphotos_dl.sh > /root/dbg.txt don’t forget to change the jail number (in my case 6) to the correct one in your system
edit: you can replace the jail number with ioc-jailname
8 thoughts on “backing up google photos into freenas”
Hi, when you say you kept your original structure, does that mean gphotos-sync did not re-download the files you already had?
If this worked I’m interested to know if you had issues with any duplicate file names.
hi giles, by “original” structure I meant folder names as “YYYY-MM” and not nested “YYYY/MM”. I didn’t paid much attention to duplicate files, as I only had a few months worth of overlap, so it wasn’t much of an issue.
Hi, I’m a very noobs in all that. Do you think you could do a video tutorial on the full procedure?
hi Seby, i’m not the expert on freenas, and never made a youtube tutorial before, but if you need some help, send me an email and i’ll do my best to help
This looks like just the guide I need. Looking forward to trying this later. I’ll post my results.
Hello, ¿This is possible with the new TrueNas?
And when can you know that images has been sync to remove them from phone?
Hi Pablo, I’m nor familiar with TrueNAS, but I don’t see a reason for it not to work on any system.
the upload from your phone to the cloud is done on the google photos app, there’s a button with a label like “123 item to delete from this phone” when you press your account icon
Comments are closed.