Main Page

From Bilbo
Jump to: navigation, search


Rants And Humor (I guess you might call it a blog)

You must realize that the computer has it in for you. The irrefutable proof of this is that the computer always does what you tell it to do.

—Unattributed fortune

Know your enemy and know yourself and you can fight a thousand battles without disaster. [...]

One hundred victories in one hundred battles is not the most skillful. Seizing the enemy without fighting is the most skillful. [...]

All warfare is based on deception.

—Sun Tzu

Computers aren't my thing. They're out to get us. I will know myself, know computers (the enemy), redesign (deceive) them, and thus seize victory without working (fighting).

This is where I rant. Everything here is Copyright Me, All Rights Reserved, so don't download any of it (oops too late, now they're out to get you).


Me

me.jpg

Don't email me or else I won't respond: bilbo@hobbiton.org

Other things I do:

Publications

Archive

Chronological Entries

Syncthing To Back Up Android SD Card

2019-11-24

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:
syncthing_enable="YES"               
syncthing_home="/project/syncthing/.config"
syncthing_log_file="${syncthing_home}/syncthing.log"

$ 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.