Skip to Content

Mission TUAWpossible: Back up your iPhone with Time Machine

Good morning, Mr. Phelps. The man you are looking at is Justin T. iPhoneuser, one of our loyal TUAW readers. Recently, Justin's iPhone went kablooey and when he tried to restore, he found that his backups were corrupted. He lost a great deal of data and time, all because Time Machine hadn't backed up his iPhone's data.

Your mission, Jim, should you choose to accept it, is to help Justin back up his data with Time Machine so he never has to face this kind of data loss again. As usual, should any of your team members be caught by Apple, the Secretary will disavow any knowledge of your actions. This post will self-destruct in five seconds...

[This is the part where the Theme Music usually plays.]

Read on for your TUAWpossible Mission Briefing.

Mission Briefing

Jim Phelps: Team TUAWpossible has learned that Time Machine doesn't automagically back up iPhone data. iPhone backups are stored in your home folder in Library/Application Support/MobileSync/Backup. The folders in that directory store backup data and their manifests for each iPhone or iPod synced to your Macintosh.

TTime Machine's standard exclusions property list specifically tells TM not to back up those folders. Barney, tell us more about the iPhone backup scheme.

Barney Collier: Thanks, Jim. As you already mentioned, iTunes stores all iPhone backup data to the MobileSync backup directory. Each backup contains a signed version of an iPhone file with a master manifest that adds a further layer of authentication to the process.

The reason that 2.0 backups take so long, Jim, is that the iPhone backs up every user file on the phone. And since all Application data is considered user data, the entire app folder is saved for every onboard application. Clearly, Apple made a misstep here since some Applications have massive data components, which must be synced during each and every backup.

Moving on, the manifest file that appears in the backup folder lists every file that was saved by the iPhone. The manifest is then signed using a secure process that involves but is not limited to SHA-1 encryption.

Jim Phelps: Barney, that sounds complicated.

Barney Collier: Yes, Jim. It sure is. Fortunately, it's relatively easy to scan through those files and recover the backed up data. Download a copy of mdhelper to your Mac, make it executable (chmod 755 mdhelper) and run it from the terminal command line. You can search through your backups and recover, for example just sql databases, e.g. ./mdhelper -C sqlitedb.

Jim Phelps: Cinnamon, stop putting on and taking off that mask (geek humor: & 0xff) and tell us about the exclusion list.

Cinnamon Carter: Sure Jim, let me put away this "Space 1999" write up and talk about that. Time Machine's exclusion list can be found on your Macintosh at /System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist. This file tells Time Machine which files it should not back up.

Jim Phelps: Can I open that up in TextEdit to take a peek?

Cinnamon Carter: It's a property list, Jim. That means you'll be far better served by opening it in Apple's Property List Editor. This is a standard utility that's included with the Xcode distribution package. Alternatively, you can open it in TextEdit if it has been saved in XML format. You can convert to XML from the command line by issuing the plutil -convert xml1 StdExclusions.plist command.

The file, when opened in Property List Editor looks something like this:

Notice the three kinds of exclusions:

PathsExcluded Time Machine excludes certain kinds of paths from backups. These folders include your Spotlight data, the trash, previous system backups and so forth.

ContentsExcluded The kind of content that TM excludes are drivers, caches and logs. These folders refer to system-level utility data that provide no benefit to the user.

UserPathsExcluded UserPaths are those data items that are stored in your home folder. These folders include both caches and logs used by Safari and Mail as well as -- you guessed it -- MobileSync backups. Rollin will tell you how to edit this to remove the MobileSync backup exclusion.

Rollin Hand: Thank you Barbara, er, I mean Cinnamon. To remove the exclusion involves nothing more than editing the property list. However, there is a snag. The property list is a system item with limited editing permissions. You'll need to edit a copy of the file and then replace the original.

  • From the Terminal command line, change directories to /System/Library/CoreServices/backupd.bundle/Contents/Resources/:
  • cd /System/Library/CoreServices/backupd.bundle/Contents/Resources/

  • Copy the property list to the desktop.
  • cp StdExclusions.plist ~/Desktop

  • Double-click the copied version to open it in Xcode's Property List Editor.
  • Select Root > UserPathsExcluded > Item 1. This is a string, the first element of the UserPathsExcluded array. Select it and press the Delete button. Property List Editor removes it from the list. Save your changes.
  • From the Terminal command line, from the backupd.bundle/Contents/Resources/ folder, issue the following commands:
  • sudo mv StdExclusions.plist StdExclusionsOriginal.plist

    sudo mv ~/Desktop/StdExclusions.plist .

    sudo chown root StdExclusions.plist

    sudo chgrp wheel StdExclusions.plist

    sudo chmod 644 StdExclusions.plst

Should at any time you need to revert to the original version of the file, it is now stored in StdExclusionsOriginal.plist.

Jim Phelps: Thank you, Rollin. That's the end of our mission for today. If you've followed along, you'll have now set up your Mac's Time Machine to back up all iPhones and iPod touches. This can be pretty data intensive -- but it might provide a lifesaving backup just when you need it, and save your top-secret organization from those meddling teenage kids.

Thanks, Alexander Burke



Categories

iPod Family Leopard iPhone

Good morning, Mr. Phelps. The man you are looking at is Justin T. iPhoneuser, one of our loyal TUAW readers. Recently, Justin's iPhone...
 

Add a Comment

*0 / 3000 Character Maximum

33 Comments

Filter by:
j2mac

I do understand the instructions, and was able to skim through them, and the cutesy stuff, with no problem. I do want to say that, in case one didn't want to risk changing a file in /System/Library (one of my "only if I absolutely have to" rules), you can just manually copy folders out of ~/Library/Application Support/MobileSync/Backup to back them up. I've been having massive problems with my iPhone's 3rd-party applications crashing, and I'm having to restore every couple of days. So I make a backup of the last known good backup. I can see the dates on the files inside each of the cryptically named folders to find a date when your phone was working.

The only problem I have had with this whole thing is that Apple's restore process has been less than stellar for me. Frequently my phone crashes about 95% of the way through the process, so about 95% of my settings and data make it back. Feh. I've been exchanging emails with AppleCare the last two days. At least they are communicating with the engineers about this stuff.

August 23 2008 at 10:54 AM Report abuse rate up rate down Reply
Henrik

All I did was copy the mobilesync-folder to my home folder, then I did a ln -s in the terminal and things seem to work just as well...

Thought that it was easier than the whole other process but I believe that Erica is a much smarter person than I am so perhaps I missed something...

August 22 2008 at 11:21 AM Report abuse rate up rate down Reply
falleri

Hm.. I did all that (with textEditor though) but I don't see the original plist file anywhere...

August 22 2008 at 9:06 AM Report abuse rate up rate down Reply
Kevin

Nice article; bad delivery.

I appreciate the occasional terminal hack. I'm sure more than 99.8% of your readers will be able to understand the instructions. For those that don't care for terminal commands please quietly move to the next post.

I am also curious about restoring something like this. A follow-up post would be welcomed.

August 22 2008 at 8:08 AM Report abuse rate up rate down Reply
Tom

Question is, why was MobileSync explicitly excluded from Time Machine?

I mean, they must have had a reason. That's what's stopping me from doing this hack.

August 22 2008 at 5:51 AM Report abuse rate up rate down Reply
tc60045

Typo in last line (minor, but for copy/pasters):

- should read .plist instead of .plst (missing the 'i')

August 22 2008 at 5:17 AM Report abuse rate up rate down Reply
Redfood

Why not provide an applescript?

August 22 2008 at 1:20 AM Report abuse rate up rate down Reply
violentlyjoyous

Erica, your work is much appreciated.
I was just bashing my head against a wall about this very issue not long ago. Very informative and useful article! :D

August 22 2008 at 12:55 AM Report abuse rate up rate down Reply
Tom Craft

Erica: Keep on keepin' on!

I too revel in the technical articles liek this one, and they are few and far between.

As for the attempt at humor, I don't care. I understood the important steps, and its nice to have something more than "just teh facts ma'am" now and then.

In short: I like, I love it, I want some more of it!

August 22 2008 at 12:47 AM Report abuse rate up rate down Reply
Jake Z

Damn, guys. Chill out. If you don't understand something, don't stab the author. Some of us revel over the (very) occasional technical TUAW article. I've got to be honest, it's these kinds of articles that I miss from the TUAW of years' past. Thank you for something new!

P.S. TUAW contributors: Though this comment means very little in the scheme of things, please consider this: Look at ATT's coverage map of the US (http://www.wireless.att.com/coverageviewer/). See all of those people without ATT coverage? Yup. We don't give a damn about iPhone news, unless, of course, you are announcing expanded service or some such goodness. I'm not at all saying that you shouldn't have iPhone articles on your blog; I'm merely saying the "computer" division of Apple, Inc. shouldn't be forgotten. Thanks for listening!

August 21 2008 at 11:12 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.