1. pyrho's Avatar
    Yesterday I was sending an SMS, then i received a phone call. And since then all my SMS are gone from my iphone.
    After searching the net i found a way to get them all back !
    BUT if you sync'd your iPhone since then, then there's no way to get them back, in the other case here is the solution:

    Itunes backs up your iphone each time you sync it, these backups are stored in *.mdbackup files. On MAC OS they are located on "~/Library/Application Support/MobileSync/Backup", on Windows it's in "CDocuments And Settings\$USERNAME\Application Data\Apple Computer\MobileSync\Backup".
    In these folders you must have other folders with strange names, open the most recent.
    Then you must get a copy of this script:
    #!/usr/bin/perl -w
    # This file clumsily extracts the DB's hidden in the iPhone backup files
    # Usage: perl -w bkupextract.pl /Users/flip/Library/Application Support/MobileSync/Backup/*/*
    my %seen;
    foreach my  (@ARGV) {
        # Slurp File Contents
        open(FILE, "<") or die "Can't open : $!";
        my  = do {local $/; binmode FILE; <FILE>};
        # skip non-SQLite Files
        ( =~ m|SQLite|) or next;
        # identify the file and use it to name the output
        my  = ( =~ m!([^/]*?).(sqlitedb|db)!) ? $1 : 'unknown';
        my  = sprintf "%s_%02d.db", , ;
        # Helpful progress report
        printf STDERR "%-60s to %-25sn", , , ;
        # dump the part between "SQLite format 3" and end
        # FIXME -- is there cruft at end?  I don't know the SQLite format.  Maybe you do?
        open(OUTFILE, ">") or die "Can't open : $!";
        binmode OUTFILE; 
        my  = ;
         =~ s/^(.*?SQLite format 3)/SQLite format 3/;
        print OUTFILE ;
    Put this code in the file lolrus.perl.

    Then run it like this: perl lolrus.perl *.mdbackup (You must run it in the folder where the *.mdbackup's are).

    This script will extract *.db files from the backups, and you should probably see a sms.db file (or sms_01.db or something like that).

    Once you have this file, copy it on you iPhone at this place: "/var/mobile/Library/SMS/". The filename must be "sms.db". /var/mobile is for 1.1.3 and onwards. If you have 1.1.2 or ealier versions it should be "/var/root/Library/SMS". Another thing, I created links in my filesystem to have more space for Applications and ****, so on my iPhone the path is "/private/var/mobile/Library/SMS", it depends. But in all cases if you can't locate this folder, just run 'find / -name "sms.db"' from a terminal (through ssh or from the iPhone's terminal) and see where that ******* file is .

    That's it you're all set ! And welcome back SMS's!
    If there are un-clear points or if some of you are having troubles doing one of the things above, just post a reply and I'll try to help !

    Hope this helps !

    Sources: TUAW[http://www.tuaw.com/2007/08/22/howto...s-from-a-mac/], and more generally google.
    Last edited by pyrho; 2008-05-01 at 08:06 PM. Reason: Quoting sources
    2008-05-01 08:05 PM
  2. koolksmart's Avatar
    Where are the backups stored for XP?
    2008-07-12 01:52 AM
  3. soulrx's Avatar
    Where are the backups stored for XP?
    CDocuments and Settings\*XP-Username*\Application Data\Apple Computer\MobileSync\Backup\sha1hash?

    So I found the mdbackups, but how do I extract them to a text file or csv or database? I have found nothing for Windows XP - would that Perl script work in windows environemnt? Could I copy the mdbackup files to a linux machine and execute that perl script?
    Last edited by soulrx; 2008-08-17 at 10:25 PM. Reason: Automerged Doublepost
    2008-08-17 10:25 PM
We have updated our Privacy Policy and Terms & Conditions. Please check them out.