Syncthing To Back Up Android SD Card

From Bilbo
Jump to: navigation, search


Syncthing is pretty cool. It's particularly handy for backing up your Android's SD card to FreeBSD. Why? So you can drop it on a stable machine where you've already been maintaining proper periodic backups. Most of this is pretty obvious for the looking, so I'll be terse:

$ pkg install syncthing

Then in /etc/rc.conf:

$ mkdir /project/syncthing
$ chown syncthing:syncthing /project/syncthing
$ service syncthing start

Now (if needed) ssh -L 8384:localhost:8384 so you can use a browser to log in to http://localhost:8384. Set a password, set it to listen on your network instead of only localhost, and Bob's your uncle. Install the Syncthing app from Play Store, and share your SD card. Just follow the GUI. I suggest setting the Android side to sync only when on wifi and charging. Now it'll sync when you're sleeping and it's on the fast local network.

Other tips:

  • It's bidirectional, so besides backing up your SD card, you can load and load things like pictures, podcasts, audiobooks, music, etc by just manipulating the files on the server.
  • Turn off Global Discover and NAT Traversal and Relay Service for security, unless you need them.
  • Tell it to exclude Android/** to avoid syncing unnecessary junk like the Google Maps cache. Then the transfer is reasonably slim.
  • Select Oldest First for File Pull Order, and I suspect it'll keep up better if the most recent files have a lot of churn.
  • Once, I had the Android app stop accepting connections, and the FreeBSD side indicated "Disconnected" and "Out of sync". nc to port 22000 indicated "Connection refused". I killed the app and opened it again, and it started accepting connections. I suppose the actual syncthing process died or something.