Skip to content

Instantly share code, notes, and snippets.

@natanlao
Last active July 20, 2024 10:17
Show Gist options
  • Save natanlao/04aba3245aeff4d01a0a5a77e71353c1 to your computer and use it in GitHub Desktop.
Save natanlao/04aba3245aeff4d01a0a5a77e71353c1 to your computer and use it in GitHub Desktop.
Syncing iPhone photos with Syncthing

For those who prefer to avoid solutions like iCloud Photos and Dropbox for backing up photos, you can sync your iPhone photos with Syncthing. To do this, you'll need two things:

  • Möbius Sync is, to my knowledge, the only actively-maintained Syncthing client for iOS. It's free to sync up to 20 MB, and only $4.99 (one-time) to remove that limit.

  • PhotoSync is a nifty iOS app for syncing photos to a number of different destinations. It's free for low-quality transfers, and $6.49 annually for full-quality, background transfers.

First, configure Möbius Sync so that you're syncing a local folder somewhere. The key here is that we can add files to a folder exposed in Files.app, and changes to that folder will (eventually) be picked up by Möbius Sync and synced to whatever destination you've configured.

Second, configure PhotoSync to automatically transfer your photos to said folder. As I noted above, you can use the Autotransfer feature to automate this. Now you're done!

This setup is pretty simple, but I've been looking for it for a while and haven't seen it documented anywhere.

There are some caveats to this approach:

  • Unless you configure PhotoSync to delete photos after transfer, storage space consumed by photos on your device will double.

  • Synchronization is not instant; there's delay between (1) when PhotoSync copies your photos/videos to your Syncthing folder and (2) when Möbius Sync picks up changes to said folder.

  • Neither PhotoSync nor Möbius Sync are fully open source.

That being said, I think this approach still makes a lot of sense if you're concerned about your privacy or want to keep your data out of the cloud. Plus, the PhotoSync team says they're planning on adding an optional pre-sync encryption feature, which is neat if that's something you're interested in.

It's worth noting that the Möbius Sync team is working on getting photo upload working in the app eventually.

Update, 3 Feb 2024: When the backup on my phone gets too large, I move the backups out of the synced folder and configure PhotoSync to only back up photos newer than the current day. This has worked well enough so far.

@dm9tr0
Copy link

dm9tr0 commented Jan 16, 2022

@Flachzange one way sync is what I need from iOS, all sorting/removing I prefer do on PC.
I agree that on android it was much easier and flexible, but after many years on android I do not want to return again, I like CarPlay, animation and camera on iOS, even apps have another actions in menu on iOS.

@ferbulous
Copy link

@Valcyclovir how do you handle live photos backup?
I noticed I get a picture and a 2-3 sec video instead of a single photo like in ios.

@SupaTWC
Copy link

SupaTWC commented Mar 20, 2022

I'll let you guys in my little setup, and it's working great so far after 2 weeks.

Requirements:

  1. Google pixel 1 or XL (Unlimited original quality video and original cloud backup)
  2. NAS storage system on a raspberry pi (for physical backup on top of cloud backup)
  3. Alternatively to requirement #2, you can set up a RAID system, but I find the rasp pi NAS storage much more versatile.
  4. Your current Android / iPhone
  5. PhotoSync
  6. Syncthing
  • my iPhone 13 has Photosync with delete after sync turned on. It is synced to my other folder on my rpi NAS storage.

Amount of free and unlimited original quality photos and videos updated so far in the past 5 years : 10TB. With 4k 60fps videos on our new phone, I expect this number to grow exponentially !

I'm trying to switch to iOS. Does your method auto transfer photos from iphone to your pi without any manual interaction? I've read background sync is very slow and doesn't work on large video files.

@Valcyclovir
Copy link

@Valcyclovir how do you handle live photos backup? I noticed I get a picture and a 2-3 sec video instead of a single photo like in ios.

photosync has a way to convert live photos, unfortunately I don't have my phone with me but check the settings.

@Valcyclovir
Copy link

I'll let you guys in my little setup, and it's working great so far after 2 weeks.
Requirements:

  1. Google pixel 1 or XL (Unlimited original quality video and original cloud backup)
  2. NAS storage system on a raspberry pi (for physical backup on top of cloud backup)
  3. Alternatively to requirement #2, you can set up a RAID system, but I find the rasp pi NAS storage much more versatile.
  4. Your current Android / iPhone
  5. PhotoSync
  6. Syncthing
  • my iPhone 13 has Photosync with delete after sync turned on. It is synced to my other folder on my rpi NAS storage.

Amount of free and unlimited original quality photos and videos updated so far in the past 5 years : 10TB. With 4k 60fps videos on our new phone, I expect this number to grow exponentially !

I'm trying to switch to iOS. Does your method auto transfer photos from iphone to your pi without any manual interaction? I've read background sync is very slow and doesn't work on large video files.

After trying photosync on my iPhone 13 for a few months, it is semi reliable when it comes to syncing. It uses geofencing and when charging at a certain time to sync photos so it isn't really reliable unfortunately. The person would have to have the phone charging at that specific time, or he would need to be at a certain location to trigger the sync, and even so, doesn't work most of the time. I have given up on looking for alternatives and will keep trying to change settings on photosync to make things a bit more reliable.
However, syncing manually is as easy as pressing 2 buttons and leaving it run in the background. Unfortunately, Apple doesn't really allow background processes and photosync so far hasn't been half bad despite the trouble of auto syncing.
Sidenote: if you have an amazon prime membership, it comes with unlimited original quality photo storage to up to 6 people. The amazon photo app is VERY reliable but it still requires you to open the app to trigger the backup. It's the easiest method by far to backup pictures and I'm running both photosync and amazon photos.

@SupaTWC
Copy link

SupaTWC commented Mar 20, 2022 via email

@Valcyclovir
Copy link

Thanks for your quick reply. Any way to download Amazon photos and get it synced to Pi? I still want to use Google Photos and already have pixel setup for uploading. Message ID: @.***>

unfortunately, I don't think so, I treat amazon photos as a completely separate entity and since I already pay for prime (which I probably will for the rest of my life), I might as well use their included features.

If you want to use google photos I totally understand ya, I have a bunch of Nesthubs at home and being able to access photos from literally anywhere is just amazing. Just keep using your google pixel 1 for as long as you can. Syncthing will not fail and the only problem is apple products not allowing background syncing and there is absolutely no way around it. Photosync makes it super easy to with 2 buttons so I totally recommend it. Don't use Mobius sync as this is a third party app of someone forking syncthing and can be discontinued anytime.

@badbob001
Copy link

@Valcyclovir

  • My Pixel 1 is plugged to my wall, has every single app disabled / deleted aside from Google photos and Syncthing. Google photos is set to auto delete backed up photos / videos after 30 days, and Syncthing on it is set to sync to NAS storage.

So does the Pixel 1 download and store all photos from the nas? One concern is that the phone will not have enough storage for all photos, but syncthing should pause the download if free space is too low and continue once google photos frees up space.

But a more important issue is: if google photos uploads/deletes older photos, then won't syncthing re-download those deleted photos again? Then the phone will always have the same photos, there won't be enough free space for the rest of the nas photos, and thus not all nas photos will be uploaded to google. I wonder if setting pixel's syncthing to be receive-only and to ignore deletes would make it not resync photos deleted by google photos. I'm guessing that In order for ignore deletes to work, syncthing must have a database to keep track of what was already synced. If that is the case, then replacing the phone or re-installing the syncthing client will lose the database and it'll try to sync the same photos already backed up to google. Ideally, google photos can recognize those local files are duplicates of what has already be backed up and delete them locally.

@mrioan
Copy link

mrioan commented Nov 13, 2022

I want to share how I managed to do this myself. This is the most automatic way I found:

  1. Install "LAN drive SAMBA Server Client" in your iPhone
  2. Start the SAMBA server
  3. Mount the SAMBA share in your machine. Something like:
mount -t cifs -o "domain=WORKGROUP,username=test,password=test,sec=ntlm,vers=1.0" \\\\192.168.1.100\\DCIM /mnt/smb_iphone
  1. Use rsync to sync your photos (your iPhone is the source):
rsync --info=progress2 -azv --delete /mnt/smb_iphone/ /mnt/my_drive/backup/iphone/photos/

BTW, LAN drive SAMBA Server Client limits the transfer speed for the free version. If you want full speed you have to buy the pro version

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