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 () and run it from the terminal command line. You can search through your backups and recover, for example just sql databases, e.g. chmod 755 mdhelper../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 . This file tells Time Machine which files it should not back up./System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist
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/:
- Copy the property list to the 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:
cd /System/Library/CoreServices/backupd.bundle/Contents/Resources/
cp StdExclusions.plist ~/Desktop
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
Share
Categories
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
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.
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...
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 Permalink rate up rate down ReplyNice 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.
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.
Typo in last line (minor, but for copy/pasters):
- should read .plist instead of .plst (missing the 'i')
Why not provide an applescript?
August 22 2008 at 1:20 AM Report abuse Permalink rate up rate down ReplyErica, 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
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!
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!
Hot Apps on TUAW
Deals of the Day
more deals- Altec Lansing Octiv Duo iDock for $48 + free shipping
- Used Apple iMac 17" Core Duo 1.83GHz for $430 + $28 s&h
- Lounge Deluxe Stand for iPhone / iPod touch for $28 + $8 s&h
- Brookstone Surround-Sound Earbuds for $14 + $7 s&h
- Refurbished Skullcandy Tokidoki Smokin' Buds Mic'd Headset for $5 + $2 s&h
- Stitchway Backup Battery for iPod / iPhone for $5 + free shipping
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



33 Comments