So yesterday My phone, Sony Xperia S, decided to go into bootloop and not boot at all, no matter what I did. Tried flashing stock PRF, stock firmware, some stock based firmware, but it would get stuck in bootloop. The reason for this being I was not formatting the data partition, which I needed to preserve since it had all My sms, contacts, call logs and other app data. Luckily, I had a working recovery(TWRP) and was able to take a backup. Then using that I was able to recover My contacts, sms, call logs and app data. After a lot of Google searches, I was finally able to work it out. The process is as follows:
Needed software:
The procedure is a lot crude as of yet, I would update as more universal and convenient options are found.
I know there is Titanium backup app which can restore contact, sms etc from nandroid backups, but You need a paid version of the app.
First we need to extract the data partition of nandroid
We will restore the SMS and Call logs first.
Currently it is limited to Windows OS only.
Now retrieving contacts. It is a bit lengthy, but simple process.
Credits and sources:
@abbot2
[TOOL] yaffs extractor, mmssms.db & contacts2.db converter
http://thydzik.com/export-android-contacts-contacts2-db-to-vcard-vcf-on-windows/
Needed software:
Code:
yaffs-mmssmsdb-calls-extractor.zip from [URL="http://forum.xda-developers.com/showthread.php?t=1585957"]here[/URL].
Firefox Browser
Firefox addon of SQLite manager : [URL="https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager"]link[/URL].
Excel macro to convert .db contacts to .csv : [URL="http://thydzik.com/downloads/convert-contacts2.db-data-to-vcard-vcf.xlsm"]link[/URL].
Software for csv to vcard conversion (Windows) : [URL="http://www.csvtovcard.com/"]link[/URL].
CSV to vcard conversion (online) : [URL="http://labs.brotherli.ch/vcfconvert/"]link[/URL].
SMS Backup & Restore android app : [URL="https://play.google.com/store/apps/details?id=com.riteshsahu.SMSBackupRestore"]link[/URL].
Call Log Backup and Restore app : [URL="https://play.google.com/store/apps/details?id=com.riteshsahu.CallLogBackupRestore"]link[/URL].
The procedure is a lot crude as of yet, I would update as more universal and convenient options are found.
I know there is Titanium backup app which can restore contact, sms etc from nandroid backups, but You need a paid version of the app.
First we need to extract the data partition of nandroid
- Rename the data.ext4.win to data.ext4.tar.gz . If Your files are like data.ext4.win000, data.ext4.win001, then rename each of them to data.ext4.tar.gz in separate folders.
- On windows, now You can directly extract them using WinRaR or 7zip application, although You don’t need to extract it entirely.
- On linux, You can do so using the following command. It is recommended to store the file in a separate folder as the file gets extracted directly.
Code:tar –xf data.ext4.tar.gz
- Now we need to find two files contacts2.db and mmssms.db . The contacts2.db files is for contacts as well as the call logs and the mmssms.db is for messages. The contacts2.db is constant across most ROM’s and OEM firmware apps. The mmssms.db file may vary as per app and ROM’s. So what You need to do is look for a .db file inside the SMS app You have been using with the firmware/ROM.
We will restore the SMS and Call logs first.
Currently it is limited to Windows OS only.
- Extract the contents of yaffs-mmssmsdb-calls-extractor.zip to a folder.
- Copy the mmssms.db file and contacts2.db file to the above folder.
- Now open a command prompt at location of the above folder. This can be done by opening the folder, right clicking using shift key pressed in blank space. You get the “Open command window here” option.
- In it type:
Code:extract -s mmssms.db
- It will ask You to enter a name for the output .xml file, You can press enter to let it give a default name. This will convert Your sms to a .xml file .
- Then type:
Code:extract –c contacts2.db
- It will also ask You to enter a name for the output .xml file, You can press enter to let it give a default name. This will convert Your call logs to a .xml file .
- Copy both of these files to Your newly formatted phone and then use the two before mentioned apps (Call Log backup& Restore and SMS Backup & Restore) to restore Your SMS and call logs.
Now retrieving contacts. It is a bit lengthy, but simple process.
- Start firefox browser. In it, after You have installed the addon do following to enable the addon
- Go to options (3 horizontal lines).
- Select “Customize” and drag the “SQLite Manager” to the blue bordered box.
- Now open options and select SQLite Manager. In it select Database>Connect Database. In the opened dialog box, select All Files(*.*). Then select Your contacts2.db .
- From the left side tree structure in the SQLite Manager window, right click on “data” and select “Export Table”.
- Now in right side part of the window, You will get CSV tab and SQL tab. Under CSV tab, simply press OK button without changing any other options.
- It will ask You to save Your .csv file. Save it.
- Now if You try to open this file directly, You will notice that file is not properly arranged.
- To arrange it properly, open the convert-contacts2.db-data-to-vcard-vcf.xlsm file. If You don’t know how to enable Macros, then do the following:
- It will show You a warning “Security Warning Macros have been disabled. Options..”
- Press the Options button. Select “Enable this content” and press ok.
- Now Press the office button present at left top corner. In it select “Excel Options”.
- Select Customize tab from left side. Then from “Choose commands from:” drop down menu, select Macros.
- Now add convertDatatoContacts and writeContactstovCard to right pane from left pane by selecting them and pressing add. Press OK button.
- Now as You can see two white square icons have been added at top right corner next to save undo redo options.
- Select the first white square icon. Select “Enable Macros” button. Now select Your .csv file in the opened dialog box.
- Now the file must have opened in a separate excel. The format should be 4 rows with they being First Name, Last Name, Phone 1 and Phone 2.
- Then select Save As>Excel Workbook>Save Type as CSV(Comma delimited).csv . Press ok and yes on the two warnings generated.
- At the left bottom, right click on “contacts” sheet and press delete. Save and close the file.
- Run CSV to vCard software and open the above saved .csv file. Here You can save all contacts as single vCard file or separate files.
- In the “Properties” section on the window, in front of “Phone 1” and “Phone 2” select “Mobile Phone” from options. Press “Convert” button.
- Alternative to above two steps, You can also convert .csv to vcard using the website.
- Now a .vcf file will be created where the .csv file was stored.
- Now simply copy the .vcf file to phone and import using the phone contacts app!
- Done!
Credits and sources:
@abbot2
[TOOL] yaffs extractor, mmssms.db & contacts2.db converter
http://thydzik.com/export-android-contacts-contacts2-db-to-vcard-vcf-on-windows/
Last edited: