We’re always told after each new jailbreak to not restore from a backup. It can eliminate those annoying errors and bugs, but it does take time. This, of course, clears out all personal information, which is often something that you want to keep. It’s one of the major tribulations about jailbreaking whenever you update. Guess what: there’s a way to keep this information without restoring from a backup. Guess what else: there’s a great guide that’s been written by forum member SomeWelshGuy.
You have to start the process before you actually jailbreak the phone, so that the information is still there. The process does take some knowledge, though it should be knowledge that you already have if you are jailbreaking. Read on for the full guide!
Extracting the data from the iPhone
Okay, so we’re going to get all of the data we need off the phone.
- SSH into your phone and navigate to /private/var/mobile/Library/
- Go into the “SMS” folder and copy sms.db to your computer.
- Go into the “AddressBook” folder and copy AddressBook.sqlitedb and AddressBookImages.sqlitedb to your computer.
- Go into the “Notes” folder and copy notes.db and notes.idx to your computer.
- Go into the “Calendar” folder and copy Calendar.sqlitedb to your computer.
- Now navigate to /private/var/wireless/Library/CallHistory and copy call_history.db to yout computer.
- Also copy all of your photos and videos from the Camera Roll to your computer. You don’t even need to SSH this, just access them from within windows explorer.
- Plug your phone in via USB and launch iPhone Explorer
- Look on the left hand pane, and click “Apps”
- You should now see all your app data on the right. They’re usually named along the lines of com.developer.appname. So if I wanted to copy “Angry Birds” data, I should drag “com.clickgamer.AngryBirds” to my desktop to save it.
So now we’ve extracted the data from our iPhone. We can now restore and jailbreak.
When that’s done, you’ll need to install OpenSSH like before, in order to give us SSH access. Now we can move onto the next step.
Copying the data back to the iPhone
It’s pretty easy to copy the data back to the new jailbroken iPhone. Just get your backups you made earlier, and copy them into the locations you originally got them from. Overwrite the stock/empty files on the phone if asked.
However this causes some access problems for the phone, which can cause some stock apps to crash or loose data. We can now go and fix this.
Fixing your SMS
You may notice now that you try to send an SMS, the app crashes. This is due to an access problem. We can fix this by using a command line tool (such as puTTY), to SSH into our phone and fix this.
You can also achieve this through mobile terminal if you wish, however as these commands can get pretty lengthy it may be easier to just copy and paste them on the computer through SSH.
- SSH into your phone.
- Type chown mobile -R /var/mobile/ into the console and press return.
- Then either respring your device or type killall SpringBoard into the console to respring.
You can now send, receive and view SMS messages without any issues.
Copying your pictures and videos into the Camera Roll
By default, the Camera Roll is read only. It can only be modified under special conditions (taking a photo, saving an image). However we can use SSH to add our photos back into the camera roll.
The issue is that SSH is wireless, and so rather slow. Photos and videos are large, so could take quite a few hours to copy. I’ve found it easier, just for this step, to use a USB type explorer. It’s much, much faster.
Anything like DiskAid or iPhoneExplorer should be okay.
- Navigate to /private/var/mobile/Media/DCIM/
- If there’s a folder there, use that. If there’s no folder, create one called “100APPLE”.
- Copy your photos and videos into this folder. If you copied them from your iPhone before then they should all be named IMG_xxxx.JPG, .PNG or .MOV.
- Look at the last numbered photo in this folder. It could be IMG_0345.JPG for example. Take a note of this number.
Fixing photo library issues
Unfortunately, this confused the photo library and the images don’t show up. In order to fix this, we can do the following through SSH:
- Navigate to /private/var/mobile/Media/PhotoData
- Delete the following files: com.apple.photos.caches_metadata.plist, Photos.sqlite, Photos.sqlite.aside, PhotosAux.sqlite, PhotosAux.sqlite.aside.
- If any exist, delete all files from /private/var/mobile/Media/PhotoData/100APPLE
- Again, if any exist, delete all files from /private/var/mobile/Media/PhotoData/Thumbnails
- And once more, if any exist, delete all files from /private/var/mobile/Media/PhotoData/Videos
Now go to your iPhone, open the multitasking bar and close “Photos”. Then open the Photos app. Wait for the library to rebuild and you should see your photos and videos.
Fixing camera issues
However by doing this, the camera stops saving new photos. They appear to be saved, but once you close the Photos app all the photos you just took no longer show up. However we can fix this.
- SSH into your phone
- Navigate to /private/var/mobile/Media/DCIM/.MISC
- Open Info.plist in a text or .plist editor
- Replace the contents of the file with this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>DCIMChangedExternally</key> <false/> <key>LastFileGroupNumber-100</key> <integer>xxxx</integer> </dict> </plist>
- Remember that number I told you to take note of earlier? Add one to that number. Then replace the xxxx in the contents you just pasted with this number. My number was 0345 in this case. So I’d replace xxxx with 346.
Now once again open command line SSH or mobile terminal.
- SSH into your phone
- Type the following command: cd /var/mobile/Media/ and hit return
- Then type chown -R mobile DCIM and hit return.
You should now find you can take photos fine, and they save properly.
Copying your selected App Data back onto your phone
This is fairly easly. Go into iTunes, and sync the apps you want to copy the data back to onto your phone. Then you need to simply launch iPhoneExplorer back up, go to Apps, and drag the app folder(s) you copied back onto your phone.
So phew! After all that hard work you should find that your SMS, Address Book, Notes, Calendar, Call Logs, Photos and Videos and selected App Data should now be exactly as they were before. And all on a fresh, clean jailbreak. Comment if you have any questions or concerns, and check out the forum guide for more information which is being updated all fairly often as more techniques and feedback comes in!