RSS
 

Recovering data from the iPhone corrupted backups

01 Apr

At times when iTunes couldn’t finish the backup process (USB cable disconnect during backup/iOS upgrade, Power failure during backup), the backup gets corrupted and remains unreadable. As the corrupted backup does not contain meta files like Manifest.plist & Manifest.mbdb, it is not possible to restore the backup onto the iPhone and it is also not possible to read the backup using backup reader software like iPhone backup browser & iPhone backup extractor. So I wrote a python script iOS-corrupted-backup-reader.py that can read & recover data from the corrupted backups. Usage of the script is listed below.

Steps to use iOS-corrupted-backup-reader.py (Windows):

1. On windows, install Python 2.6.
2. Download iOS-Corrupted-Backup-Reader.py and place it in C:\ drive.
3. Create two folders backup & output in C drive.
4. From the iOS backup directory C:\Users\[user-name]\AppData\Roaming\Apple Computer\MobileSync\Backup\[iPhone-UDID]\,  copy all the files and place them in C:\backup directory.
5. Open  the command prompt, navigate to C:\ drive and type the below command.

\Python26\python.exe iOS-Corrupted-Backup-Reader.py c:\backup c:\output

6. It converts the backup files into readable format and places them in C:\output directory.

Steps to use iOS-corrupted-backup-reader.py (Mac OS X):

1. Create two folders backup & output on Desktop.
2. Download iOS-Corrupted-Backup-Reader.py and place it on Desktop.
3. From the iOS backup directory ~/Library/Application Support/MobileSync/Backup/[UDID], copy all the files and place them in backup directory.
4. Open the terminal and run the below command.

Python iOS-Corrupted-Backup-Reader.py ~/Desktop/backup/ ~/Desktop/output/

5. It converts the backup files into readable format and places them in output directory.

The script extracts and structures all the default files like Contacts, SMS, Calendar, etc. into directories with actual file names. Other third party application files are converted into readable format and gets stored in other-data folder in output directory without actual file names. Manifest.mbdb file maps the actual filenames to backup filenames and the mbdb file is not available in the case of corrupted backups. So it is not possible to get the exact file names. In general, most of the iOS applications store the data in plist, sqlite and Jpeg format. You can use plist editor sqlite spy and image viewers to open the files and read the data manually.

Note: Data recovery is only possible in the case of normal backups. If the backup is encrypted (encrypt backup option is checked in iTunes), it is not possible to read & recover the data from the corrupted backups.

 
 

Tags: , ,

Leave a Reply

 

 
  1. Karsten Hoffrath

    May 18, 2013 at 1:13 am

    Thank you very much for the script. It rescued 400 MB worth of pictures and videos from a borked iTunes backup.

    Keep up the good work!

    Cheers
    Karsten

     
  2. Johan

    June 25, 2013 at 1:06 pm

    Hi,
    How do I get the sms/text and notes from the “output” folder back to the iphone? Im sorry but Im not that good at this…

     
    • satishb3

      June 25, 2013 at 9:55 pm

      You dont need to use these tools to put it back onto iPhone. Follow this-
      1. Copy your existing backup files to some folder.
      2. Take a new backup of u r phone.
      3. Replace the new files with old backup files then restore.

       
  3. scott

    July 3, 2013 at 8:39 am

    c:\>\Python26\python.exe iOS-Corrupted-Backup-Reader.py c:\backup c:\output
    Traceback (most recent call last):
    File “iOS-Corrupted-Backup-Reader.py”, line 56, in
    f=open(ffullname,’rb’)
    IOError: [Errno 13] Permission denied: ‘c:\\backup/24b922519f8fd3fb332b3c0c16687
    32eecfcf00f-20130701-125445′

    I ran as admin… any thought’s?

     
    • scott

      July 3, 2013 at 9:20 am

      got it sorted….now to figure out how to open all the db files

       
      • satishb3

        July 3, 2013 at 7:15 pm

        Glad that you figured out the problem. share your solution here, that would help the readers.
        You can open the db files with any sqlite viewer.

         
      • uly

        August 9, 2013 at 12:21 pm

        how did you fix this error please?

         
  4. adam harrison

    August 20, 2013 at 11:55 pm

    Now that I have my output folder how do I actually restore these to my phone?

     
    • satishb3

      August 21, 2013 at 4:11 pm

      You don’t need to run that script to restore the stuff onto your phone. Just follow the below steps –
      Take a backup of iPhone backup folder.
      Take new backup of phone.
      Replace the new backup files (except manifest.mbdb) with old backup files.
      Now restore the backup.

       
      • adam harrison

        August 23, 2013 at 9:45 pm

        Thanks for the reply, that seemed to help but did not ultimately fix the problem. At the completion of the restore I get the same message that the backup is corrupt or not compatible with this iphone. Any other suggestions? Thanks!

         
        • satishb3

          August 25, 2013 at 7:22 pm

          Try replacing only the important files like contacts, sms. You can find the corresponding file hashes in the python script (open the python file with notepad).

           
  5. Splendid Bob

    September 21, 2013 at 3:04 am

    Whoever wrote this little script and web page… I love you! Just recovered over a thousand “lost” pictures, Many cherished ones of my children over the last year. THANK YOU!!

     
  6. Will

    September 30, 2013 at 6:26 am

    I am getting this error in Terminal:

    Python: can’t open file ‘iOS-Corrupted-Backup-Reader.py’: [Errno 2] No such file or directory

    any thoughts? I have the iOS-Corrupted-Backup-Reader.py file on my desktop.

     
    • satishb3

      September 30, 2013 at 6:29 am

      Try to run terminal with admin rights. or try renaming the python file.

       
    • Fred

      October 26, 2013 at 9:56 am

      Click windows icon in bottom left corner of screen.
      Click in the search box.
      Type CMD and enter.
      Brings up Command Prompt.
      Type cd..
      Type again cd..
      Now should say
      C:\
      Now you can copy and paste the line in this tutorial.

       
  7. Jean-Philippe Rosa

    November 5, 2013 at 2:33 pm

    Hi,
    Very nice website and post.
    I have a small problem though: as mentioned by Scott earlier, I get the “Python: can’t open file ‘iOS-Corrupted-Backup-Reader.py’: [Errno 2] No such file or directory” message (on Mac OS 10.8.5, or on Windows 7). Scott said he figured out the problem, but unfortunately didn’t post his solution… The problem may come from the format of the downloaded file (which shows up as text on the “iOS-Corrupted-Backup-Reader.py” link)… Downloading either as webarchive, MFAF MHTML formats or page source (txt) doesn’t change a thing…
    Any idea?

     
    • Anwar

      November 14, 2013 at 6:44 pm

      type in the command prompt this cd.. and press enter do it again and then go ahead with this tutroial

      my problem is a message says python is not a win-32 compatble

       
  8. omar

    April 4, 2014 at 2:06 pm

    hey mate im not able to download this scrpit
    2. Download iOS-Corrupted-Backup-Reader.py and place it in C:\ drive.
    how come?

     
    • satishb3

      April 4, 2014 at 8:33 pm

       
      • omar

        April 5, 2014 at 5:45 am

        Hey guys , im having issues here.
        1) i made a copy of my old backup iphone file
        2) downloaded python
        3) opened the direct link for the script and copied and pasted it into Python shell
        4) saved the script in python shell to iOS-Corrupted-Backup-Reader.py
        5) made 2 folders in C:\ drive . backup and output
        6) pasted my old back up into the backup folder in C:\
        7) opened Command prompt
        8) typed C:\Python26\python
        9) python started in command prompt
        10) then typed iOS-Corrupted-Backup-Reader.py c:\backup c:\output exactly
        11: syntaxError: invalid syntax (there is a little arrow pointing to the c:\backup part)

        please help me….. ive been watch clips , reading non stop to how to fix this ,,, its starting to hurt my brain

        thank you very much