Recovering data from the iPhone corrupted backups

April 01

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 that can read & recover data from the corrupted backups. Usage of the script is listed below.

Steps to use (Windows):

1. On windows, install Python 2.6.
2. Download 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 c:\backup c:\output

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

Steps to use (Mac OS X):

1. Create two folders backup & output on Desktop.
2. Download 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 ~/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.


Posted by on April 1, 2013 in iPhone


Tags: , ,

51 responses to “Recovering data from the iPhone corrupted backups

  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!


  2. Johan

    June 25, 2013 at 1:06 pm

    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 c:\backup c:\output
    Traceback (most recent call last):
    File “”, line 56, in
    IOError: [Errno 13] Permission denied: ‘c:\\backup/24b922519f8fd3fb332b3c0c16687

    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?

        • Ty

          April 23, 2014 at 12:26 am

          Did anyone figure this out? I’ve ran into the exact same issue

          • Ty

            April 23, 2014 at 12:26 am

            I’ll keep working on it and if I have any luck will post.

        • amon

          September 22, 2015 at 9:30 am

          You need to click and open the corrupted backup folder, select all of the files inside and copy and paste all of the files into the backup file on the C drive. I ran into the same error because I just copied and pasted the folder itself, but kept getting this error, tried this and it worked. Hope this helps.

    • Ty

      April 23, 2014 at 1:17 am

      So I just figured this out. For me, it was because I had copied a folder full of the backup files into c: backup. Instead, I needed to copy all of the files themselves directly into the backup folder. I know nothing about IT, so this probably seems obvious to most, but just in case anyone has this permission issue…

      • Mohsen

        January 10, 2015 at 3:24 pm

        it dos’n need backup folder !!!
        We Should put Just Backup Files…

        Thanks All … 🙂

  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).

          • Ty

            April 23, 2014 at 2:41 am


            You’re script was extremely helpful, thank you very, very much. I’m having the same problem now though. I have everything in the output folder and I believe I’ve identified where my contacts are (address book, within “Library” folder (?)), but now how do I identify what to replace within a new iPhone backup in order to get my old contacts in there. Contacts are the only thing I care about getting restored.

          • satishb3

            April 23, 2014 at 9:38 am

            Thanks. To load contacts to iPhone,
            1. Rename addressbook file to 31bb7ba8914766d4ba40d6dfb6113c8b614be442.
            2. Take a new backup of your phone.
            3. navigate to bakup folder – C:\Users\[your username]\AppData\Roaming\Apple Computer\MobileSync\Backup\[your phone id]
            4. Copy file in step 1 and paste it in step 3 folder (replace it).
            5. Restore the backup to phone.

  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 ‘’: [Errno 2] No such file or directory

    any thoughts? I have the 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
      Now you can copy and paste the line in this tutorial.

  7. Jean-Philippe Rosa

    November 5, 2013 at 2:33 pm

    Very nice website and post.
    I have a small problem though: as mentioned by Scott earlier, I get the “Python: can’t open file ‘’: [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 “” 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 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
        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 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

        • omar

          April 5, 2014 at 5:48 am

          i also placed the script save file in C;\Python26

        • satishb3

          April 5, 2014 at 8:15 am

          Python code needs proper indents to execute. That might be the reason for syntax error.
          To make it simple, I placed the py file in a zip –
          Download the zip and extract it to get the py file.

          • Bernard

            June 21, 2014 at 2:47 am

            Hi There im new to Mac and Im getting same error as Jean Philippe and Will, tried remaining the file as you suggested but didnt work, am I being dumb? im running terminal as admin, im on OS X10.9.3

            Error is:
            Python: can’t open file ‘’: [Errno 2] No such file or directory

            Many Thanks

          • Bernard

            June 21, 2014 at 10:29 pm

            I fixed it, had to put desktop into the file path

            Python desktop/ ~/Desktop/backup/ ~/Desktop/output/
            Rather than the specified path,
            Python ~/Desktop/backup/ ~/Desktop/output/

  9. Flea

    August 30, 2014 at 4:04 pm

    Are you still here?

    I’m having a problem with a backup. I’ve extracted the files tot he output folder but I cant seem to access the information in the sqlite/plist files.

    • satishb3

      September 1, 2014 at 12:26 pm

      Is the backup encrypted ?

      • Flea

        September 2, 2014 at 5:05 pm

        Hey, no its not.

        • satishb3

          September 2, 2014 at 7:44 pm

          In that case they would open. Are those files (plist/sqlite) belong to any native app or apple default files? If they are apple default files, they will open. If they are app related, app might have used encryption.

          • Flea

            September 6, 2014 at 8:28 pm

            I’m not sure, I open them with plist/sqlite but I cant find any information. The most important one is “notes”, the default app in Apple. I’m using the apps sqlitebrowser and Plistinator on a macbook.

  10. Dominik

    September 3, 2014 at 3:12 am


    thank you so much for your great work.
    I tried it with iOS 7.1.2 where my manifestfile seems to be corrupted. message occurs “backup file is not compatible” Unfortunately your recommondations with renaming the addressbook file (which one by the way?! I tooked the biggest, there are two in the subdic) to that hex one and put that in the folder of an “blank” backup which I made after the recovery and still got the same error message… tried to copy&replace all files besides manifest.mbdb already as well, same error…


    • Nick

      September 5, 2014 at 11:06 am

      Thanks so much! I was able to run the script and retrieve all of my files! Is there a way to restore the settings and files directly to my iPhone? Thanks!

      • Nick

        September 5, 2014 at 11:15 am

        I noticed that the contents in the backup folder is deleted after running the script. Is there a way to reverse the process so I can copy the backup files to a new backup folder to restore, as I understand that may work?

  11. jia

    September 23, 2014 at 7:28 pm

    Is there a way to reverse the process after the files have been removed from the backup folder?

  12. Ben

    October 8, 2014 at 4:49 am

    Works like a charm. I was dreading writing this script myself and then came across your article! Thanks a bunch!

  13. Anya

    November 12, 2014 at 5:43 am

    Hey, would really appreciate some help!

    I’m using windows and getting the same error message mentioned above (can’t open file ‘’: [Errno 2] No such file or directory). I am the admin and I have tried renaming the file. I have also tried writing in cd twice before entering the line in the guide but this does not change anything. As in the line still starts with C:\Users\User>

    Not sure what to do as I don’t know much about this but have some really important things I need to access. Thank you so much in advance!

    • satishb3

      November 12, 2014 at 9:05 pm

      Can you paste the complete command which you tried ?

  14. Jacques Siboni

    December 19, 2014 at 5:47 pm

    Thank you for this Python code. I could restore the original architecture with it. But now it is not obvious for me how to put the data back on the iPhone. Let me explain. With the sync the pictures and musics are restored automatically; the calendar, notes and adresses are not lost as I used Google to store them. The problem is with the data associated with the applications, ie TomTom etc. I find files being jpeg, sqlite and plist but I don’t know what to do with them. What do you suggest? Thanks in advance. Jacques

    • satishb3

      December 19, 2014 at 6:33 pm

      Restoring data to phone is difficult. One way of restoring stuff is, install the same apps on your phone again & use it. Later take a fresh backup. Replace the new backup file with old file (file names will be same without extension) and restore the backup to phone. That might help.

      • Jacques Siboni

        December 19, 2014 at 6:55 pm

        Thanks for your care of my problem.
        1- many file names are different
        2- there are 7700 files on other-data and 12000 on the backup. I don’t know how to choose the proper files for each application.
        3- when copying is it mandatory to remove the file extension?
        Thanks in advance. Jacques

        • satishb3

          December 19, 2014 at 7:39 pm

          As I said restoring everything is not that easy.

          1. Yes, they might be different. Apps might have changed file names with newer app versions.
          2. Just install whatever the apps that you require. Then take backup. Write some program or find some tool, that compare filenames in two folders. If a file matches, then copy that old backup file to new backup.
          3. yes, have to remove extensions.

          Before trying anything, take a backup of your phone and copy that backup folder to some other place. So if something goes wrong, that will help.

  15. VeryThankfulStranger

    August 17, 2015 at 7:45 am

    Thank you so much for this, the script still works!

    I had backed up my iPhone but after an upgrade, it wouldn’t let me restore from backup, saying it was corrupted. No contacts, no text messages, app data, like I had a brand new phone.

    Thanks to your script and a host of other programs and hours spent researching, I’ve got my phone 99% back to normal.

  16. Goomer

    September 16, 2015 at 2:08 am

    The script says it successfully moved files, but in the Media folder, I only have a MISC folder and a Photos.sqlite what am I doing wrong?

    • Goomer

      September 16, 2015 at 2:34 am

      It essentially does nothing, usually I would expect it to take tens of minutes to process the files, yet I get a “successful” message after entering the command

    • satishb3

      September 20, 2015 at 11:45 am

      May be the backup does not contain photos.


Leave a Reply

Your email address will not be published. Required fields are marked *