Wednesday, October 6, 2010

Viewing Deleted Messages in Your iPhone Backup

Update: Decipher TextMessage can read some deleted texts out of the backup for you. We hope you'll give it a try! http://deciphertools.com  We also have a video about using Decipher TextMessage for recovery on YouTube.

Many people who purchase Decipher TextMessage write us asking about the ability to recover deleted messages.  When we say "deleted messages" here, we mean messages that were received and deleted between backups, so that there is no record of the message in a backup.  If you have backed-up your device prior to when the text was deleted, you can use Decipher TextMessage to read the texts in that backup to recover it.  But, the iTunes backup schedule doesn't always nicely coincide with the schedule of our accidents, our fits, or children playing with our phone.  When we get those emails, it tugs at our hearts because we know that you wouldn't be writing if that text wasn't important, and it feels awful having lost it possibly forever.
We're working on adding the ability to read as many deleted messages as we can from the backups, but in the meantime, we wanted to explain why some of your deleted texts may not be totally gone, and how you can go and look for them by hand.
We're going to walk through the steps assuming that you're on a Mac, but the general idea applies on Windows as well.  Also, folks using Windows can check out this very nice walk-though here.

Why your deleted texts may still be around

The iPhone OS stores your texts in a database system called sqlite.  This is relevant because of the way that sqlite handles deleting entries in the database.  When you delete an entry (aka a text), rather than totally obliterating the entry in the database, the entry is just marked as no longer in use, and will be reused later.  There is a chance that the entry for the text you're wishing to see has been recovered and used for a newer text, in which case the text is indeed gone forever.

Looking at all of the messages, including the "deleted" ones

Until we have Decipher TextMessage read those entries waiting to be reused, to look at your deleted messages, you'll have to take a look at the sqllite file by hand.  It's not pretty, but if you know what you're looking for it's doable.  If you haven't already made a backup since the message was created and subsequently deleted, you will need to do so now.  You can force a backup in iTunes by right-clicking on your device under Devices on the left-hand side of iTunes and then selecting "Back Up".
Open Finder and navigate to Home (your username) -> Library -> Application Support -> MobileSync -> Backup.  Within that folder, you will see one or more folders; each one is a backup of a iOS device (iPhone, iPod Touch, iPad).  The awful names are identifiers that iTunes uses to know which device is which, so that it can overwrite the correct backup when it makes a new update of a device.  If you're unsure which folder is for the device that you need to examine, you can use trial and error with the steps below, or if you have Decipher TextMessage 1.5 the folder names are listed in the information window showing which backups were loaded. 

Now that you've found the folder click on the folder to show the files within it.  You'll see more awful file names, either ending in .mddata, .mdinfo, or .mdbackup if you're running iOS 3.1.x (or lower) or ending with nothing if you're running iOS 4.0 (or higher).
The file of interest to us is "3d0d7e5fb2ce288813306e4d4636395e047a3d28" (or "3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata" or "3d0d7e5fb2ce288813306e4d4636395e047a3d28.mdbackup").  You can find this file in the list by looking through the list (you can alphabetize this list by going to View -> Show View Options and setting the sort order to alphabetical), or by typing in "3d0d" into spotlight in the upper right corner of your finder window.  If you use spotlight, be sure to select to search within just this folder, and by file name.
This file contains the sqllite database for your sms messages.  Right-click on the file and select Open With -> TextEdit.  If TextEdit is not an option yet, select Open With -> Other... and then find TextEdit within the Applications folder.
The top of the file will look like a pile of gibberish, the gibberish is a bunch of sqllite commands about the database table.  If you scroll down a bit, you'll start to see garbage mixed in with the contents of your text messages.  If you squint your eyes a bit and look some more, you'll also see that the phone number for the other party is listed along with the message text (and more sqllite "garbage" of course).
From here, you'll have to explore the file and see what you can find.  Techniques that we find helpful are to search (with command + f) for text that we think was in the message or to search for the other party's phone number, hitting next to jump through all occurrences of it in the file.  It's not glamourous work, but when the deleted message is important, it's worth it!

25 comments:

  1. what if i cant fond anything that starts with mobile on the apllications support folder?

    ReplyDelete
  2. I cannot see mobile sync either after application support. I am using a mac. I am using IOS 5 and the latest iTunes.

    ReplyDelete
  3. dells11 make sure you are looking in "users/yourusername/library/"
    it won't be in /macintosh HD/library
    you may need to use the "Go" command in finder.

    ReplyDelete
  4. Thanks Lucas. . I'm still struggling as i can't find a text that i deleted 2 days ago. It doesn't appear in the text edit fashion or in the recovered message.
    I even deleted another message to see if thats "recovered" but its not. Anything i can do to my phone or settings to make these texts appear.
    Thanks in advance.

    ReplyDelete
  5. He dells11

    Unfortunately, if you're not seeing the message when editing that 3d0d7... file, it's not there to be recovered, and there isn't much to try beyond that. Are there any other backup folders within your MobileSync/Backup folder to check in?

    ReplyDelete
  6. I just ran two separate tests with the same result.

    I sent myself a text that read "edit to delete" and one that said "swipe to delete" - I then deleted one by pressing edit then delete, and the other by swiping over the conversation then delete.

    Made a new back up.

    The "swiped to delete" texts do not appear within the program or by manually searching the file.

    The "edit to delete" texts appear within both.

    Repeated the process again with same results.

    Your thoughts?

    ReplyDelete
  7. Hi Brandon,

    That is interesting, especially since I would guess that the SMS app uses similar code for both cases. The magic is in whether or not the database file leaves any remnants lying around in the spare space.

    I wonder if we reverse the order if we get different results :)

    ReplyDelete
  8. I tried to recover a text message on my PC by going to My Computer> Local Disk (C:)> Users> me> AppData > Roaming> Apple Computer> MobileSync> found the 3d0d7 file but wasn't able to find the text I was looking for.

    Is there somewhere else I can search or another method I can try?

    ReplyDelete
  9. Unfortunately, if you open that 3d0d7 file (as a text file) and don't see any of the message, there isn't a lot else more to go on. A few things you can try: 1) Open iTunes and in Preferences -> Devices, make sure the date of the last backup is after the message existed :) 2) On your phone, you can try searching (slide to the home screen page previous to your first page of apps) for some of the text -- occasionally the text is still cached in the iPhone search functionality.

    ReplyDelete
  10. I am Using Software Mac OS X Lion 10.7.2 and I can't find anything similar to what you describe. There os no users/yourusername/library? Are there different directions for the newest mac software? There is no option for "library" after home?

    ReplyDelete
    Replies
    1. Excellent question -- on Mac 10.7 Lion, the Library folder is hidden by default. You can unhide it by opening Terminal (Applications -> Utilities -> Terminal) and typing

      chflags nohidden ~/Library/

      (the tilde ~ is next to the 1 key)

      Delete
  11. How can you tell who sent the message? Is it the number above or below the message?

    ReplyDelete
  12. Any other file we can find deleted texts messages in ?

    ReplyDelete
    Replies
    1. Not that we know of, but we are actively looking!

      Delete
  13. Is there a way to find this file for a specific iphone? I sync two phones to my computer and I can only find this file for one of the phones.

    Thanks

    ReplyDelete
    Replies
    1. Are you sure that you've backed up the second phone? Syncing doesn't always create a backup (we have a blog post about that too! http://decipher-media.blogspot.com/2011/05/itunes-sync-vs-backup-how-to-ensure-you.html)

      In iTunes, make sure that you've selected "Backup to: This computer" instead of "iCloud" (if even just for a moment), right-click on your phone and select "Back Up".

      Delete
    2. What if i had not back up my data files in iTunes, even or in icloud, please?

      Delete
  14. The original page with instructions for Windows linked to by this post has disappeared, but we had a saved copy so that we can share it here. Originally from "The General Theory of RIAtivity":

    I figured I’d post this as a follow-up to my previous post a few years back mainly because I regularly get questioned on the topic of how to retrieve deleted text messages. Furthermore, I wanted to post a method which didn’t require JailBreaking a phone or that was overly technical. So here you go, a pretty straighforward method for accessing text messages from your iPhone which may have been deleted but might still be available in the iPhone’s SMS database.

    ASSUMPTIONS: I assume you are running Windows of some flavor and have synched/backed up your iPhone using iTunes on said machine.

    1. Download and install TextPad (http://www.textpad.com/download/index.html)
    2. Open TextPad.
    3. Select Search > Find in Files…
    4. Complete the “Find in Files” dialog as you see in the following screenshot. Make sure you’ve checked the Search subfolders checkbox or else this won’t work. Note: this was taken from a Windows 7 machine. The path value for the “In Folder” field should be the same for Windows Vista (of course, your username will appear instead of “mike” in the path. For pre-Windows Vista your path will be under c:\Documents and Settings\[username]\Application Data\Apple Computer\MobileSync\Backup\


    5. Click Find.
    6. In the TextPad search results pane you should see at least one search result found (even though multiple results may have been returned, they all will point to the same SMS DB file per backup folder). Below is a screenshot of what might appear (your filename will likely be different):

    7. Double-click on one of the search results and the SQLite file will open in the upper pane. Much of it will look like garbage, but there’s alot of human readable info in the file, particularly your text messages. Enjoy

    ReplyDelete
  15. I have read this blog which provide me good information regarding how to view deleted messages in iPhone.In this case Decipher TextMessage help me to recover all the deleted data.
    So thanks for providing this information.

    iPhone App Development

    ReplyDelete
  16. Thank you for the fantastic article. The place else could anyone get that kind of info in such a perfect means of writing ?
    DVD packaging

    ReplyDelete
  17. I want to show my admiration of your writing skill and ability to make audience, browse the whole thing to the end. I'd really like to read more of your blogs and to talk about my views with you. I'll be your frequent website visitor, that’s for sure.

    Promotional USB Drivers

    ReplyDelete
  18. I tried the '3d0d' search in TextEdit, as detailed above, and found deleted text messages in iTunes backup of a iPhone 4s on a Mac. It works! I don't know if it is all of the deleted text messages but it is enough. Thanks.

    I have a few questions though.

    1. I can see the phone number of the iPhone that was backed-up and I can read within the gibberish the deleted text messages of that that iPhone. I can also see the deleted text messages from another person but their phone number does not show up or it is in the gibberish. How can I 'make readable' or draw out of the gibberish the other persons phone number and associate it with a particular text message so that I can prove who that text message came from?

    2. Similar to above, the date and time of particular text messages is not readable or is in the gibberish. How can I make the date and time of a particular text message readable?

    3. Lastly, where are the deleted text message attachments (pics mainly) located within iTunes backup on a Mac?

    Thanks.

    ReplyDelete
    Replies
    1. Hi Todd,

      1) Are you using iOS6 on the 4s that you're looking at backups for? The phone numbers are much harder to extract (and sometimes not possible to extract) from the deleted database rows for iOS6.

      2) The dates are in numeric format, for iOS6 they should be the seconds since 2001.

      3) The pictures *should* be deleted when the message is deleted, but occasionally are not. The way the backups work, the names are hard to predict (and should be scattered amongst the hashed file names).

      Have you given our Decipher TextMessage program a try? It will try to figure out some of the contacts for deleted messages (we're working on adding more strategies for this), and translate the dates for you. We also have been working on some beta versions of the program that will look for deleted images.

      Delete
  19. I just downloaded Decipher TextMessage 5 on my PC. The text messages I want to decipher is the '3d0d' file that I have on a disk. I do not have access to the iPhone 4s or to the iTunes backup of said 4s on this PC. I only have the '3d0d' files that I saved on disk from the iTunes backup of the 4s which was on a Mac.

    How do I 'import' the '3d0d' files from the disk into Decipher TextMessage 5?

    ReplyDelete