Results 1 to 3 of 3

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.

Thread: All SMS lost? Possible solution explained

  1. #1
    What's Jailbreak? pyrho's Avatar
    Join Date
    Nov 2007
    Thanked 2 Times in 1 Post
    Default All SMS lost? Possible solution explained
    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 /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[], and more generally google.
    Last edited by pyrho; 2008-05-01 at 07:06 PM. Reason: Quoting sources

  2. The Following 2 Users Say Thank You to pyrho For This Useful Post:

    atifds9 (2008-05-02), tanzfleur (2008-05-05)

  3. #2
    Green Apple
    Join Date
    Sep 2007
    Stockton, California
    Thanked 2 Times in 2 Posts

    Where are the backups stored for XP?

  4. #3
    Quote Originally Posted by koolksmart View Post
    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 09:25 PM. Reason: Automerged Doublepost

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts