backup

How to: back up your iPhone with rsync

iTunes hates me:

A couple of weeks ago, iTunes decided to stop talking to my iPhone. For some reason, iTunes on my computer decided that my phone wasn't authorized to use my iTunes Store account.

My phone thought it was legit... Everything continued to work on that end. My computer thought it was cool. But somewhere in the connection between the phone and computer, iTunes decided that it would be best to wipe my phone. Which it continued to offer to do every time I tried to sync.

No me gusta.

So I'm taking drastic measures:

Since iTunes is being lame, it won't let me back anything up. Luckily, my friend rsync never fails me.

In short:

  1. Use rsync to back everything up.
  2. Let iTunes do its wipey/restorey thing.
  3. Recover the stuff I care about via reverse rsync.
  4. ...
  5. Profit!

Because I always forget how to do things:

Here's how to use rsync to back up your iPhone... This process requires a "liberated" phone, with OpenSSH installed (and turned on). But that whole process is beyond the scope of this post.

To rsync all the important stuff off your phone, make sure your phone is on, SSH is running, and everything is connected to the same network. Then open Terminal, change to an appropriate directory, and type this:

rsync -avz --stats --progress --exclude "private/var/mobile/Media/iTunes_Control/Music" root@YOUR_PHONE_NAME.local:/ ./backup

Of course, you've gotta replace YOUR_PHONE_NAME with the actual name of your phone...

It will ask for your phone's root password. If you haven't changed it, this is probably "alpine". Also, shame on you.

iPhone backup shootout: iTunes vs. rsync

iTunes' iPhone backup is absolutely horrid. i've just about decided to completely replace it with rsync, so i figured i'd give it one last go. it's been 2 hours since i plugged my phone in and iTunes auto-synced. it's been over a week since my last rsync backup. how do they compare?

time

iTunes backup—crashed after 1.5 hours. resulted in corrupted backup, will not be able to restore from it.

rsync—5 minutes, 32 seconds.

connection

iTunes backup—plug in via dock connector/usb.

rsync—wi-fi.

speed

iTunes backup—USB 2.0 theoretical maximum: 480 Mbits/second. actual speed: approx 2.3 Mbits/sec.

rsync—actual transfer speed: 440 Mbits/sec.

data transferred

iTunes backup— ~16 Gb

rsync— ~155 Mb

data availability

iTunes backup—stored in a single compressed image. not available.

rsync—stored in a standard folder on my data drive. very available.

revision availability

iTunes backup—last backup. available only as a complete reimage, assuming the last backup didn't crash. if last backup crashed (about 66% probability, in my experience), not available at all. ever.

rsync—thanks to the magic of Time Machine, every single sync is backed up. every change. every revision. these backups can be restored piecemeal, as needed.

ease of restoration

iTunes backup—plug in phone. hope iTunes has a valid backup image. curse.

rsync—run the reverse rsync command, go about your merry way. can restore a single app or folder, or the entire iPhone.

triggers

iTunes backup—plug phone into computer, manual sync.

rsync—cron jobs, folder actions, bluetooth proximity, IP address availability, manual sync.

approx wait after plugging phone into computer before i can do anything with my phone other than looking a pretty "syncing" screen

iTunes backup—1.5 hours

rsync—0 seconds

final score

iTunes backup - 0. rsync - 10.

verdict?

wow.