• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Need to nandroid restore data only...

sublimnl

Well-Known Member
Nov 6, 2009
151
2
Hi guys, I am a droid user, but my wife has an eris and I am trying to get her phone from one of the 2.1 leaks to the official 2.1 OTA with root.

Tonight, I downloaded a "PlainJane" ROM from XDA which seems to be the 2.1OTA with an OC kernel, which sounded like exactly what I needed. So, I performed a nandroid backup of her phone as it is and then I went into the nandroid restore menu to see what my options were with the Amon recovery image. Turns out there was no "advanced" nandroid restore option like we have on Clockwork and SPRecovery on the Droid, so my original plan of wiping, installing the new ROM, and then restoring data was dashed.

So, I attempted to just flash the new ROM on top of the 2.1 leak. This resulted in tons of FC's on boot up. I then rebooted the phone, did a full wipe, then installed the ROM. It then booted up just fine, but without any of her data of course. That is no good though as I promised her I wouldnt lose her data (again, LOL). So, I then wiped again and proceeded to restore the nandroid backup I did before I started and now the phone is right back to where it was before all of this.

OK, having said all of that, I really want to just wipe, install the ROM, then restore the data on top. Is that not possible on the Eris? Is there a different recovery image I should be using that will allow me to do this? I do it on my droid all the time and it makes swapping ROM's a breeze.

Thanks in advance for the help!
 
OK, having said all of that, I really want to just wipe, install the ROM, then restore the data on top. Is that not possible on the Eris? Is there a different recovery image I should be using that will allow me to do this? I do it on my droid all the time and it makes swapping ROM's a breeze.

Thanks in advance for the help!

Nandroid stores data in each backup on a partition-by-partition basis - including the /data partition (in "data.img").

Have a look at the "nandroid-mobile.sh" script in /sbin for the recovery boot. ( You can either unzip Amon_RA's recovery to get that one file, or do an "adb pull /sbin/nandroid-mobile.sh nandroid-mobile.sh" with the recovery boot running to get a copy of the file. )

Basically, the "data.img" file which is on your SD card is just a yaffs2 image, and there is a tool right on the phone for unpacking it (/sbin/unyaffs).

More or less, what the nandroid-mobile.sh script does when restoring the data partition is the following.

With the phone in Amon_RA recovery boot, do an "adb shell" from the PC and:

Code:
mount /sdcard
mount /data
cd /data
rm -rf /data/* >>/dev/null 2>&1
unyaffs /sdcard/nandroid/HT9xxxxxx/BDS-whatever-19691231-0000/data.img
cd /
sync
umount /data
umount /sdcard

Obviously, you will need to change the path to your backup "data.img" appropriately.

What you would do would be to perform a wipe; flash the Plain Jane ROM; and then do the above restore. (Optionally, after the /data restore you might want to wipe just the Dalvik cache).

In the wrong hands, the above "rm" command could be dangerous, but not catastrophic. If you do not feel comfortable using this, DON'T. You accept all risks for whatever happens if you manually attempt the above.


Having said all this, something mystifies me about your inquiry.

If you had installed a "Leak" using a PB00IMG.ZIP (HBOOT) method, there would not be a way to get root... so when you say "one of the 2.1 leaks", you mean the ROOT leak, yes?


eu1


PS I expect that many of your factory apps will work just fine with the overlay from the older (root-leak) HTC 2.1 OS - but there is no guarantee that they all will. No doubt some apps have changed - possibly even important ones, and their corresponding caches in /data/data/com.appname-whatever and .dex files in /data/dalvik-cache/*.dex will be incorrect.

You might be able to get some insight in to this by comparing the app .apk file MD5 signatures between the releases - you should be OK with any apps that have matching signatures, but you would probably want to delete the Dalvik .dex and /data/data/com.whatever folders for the apps that have a mismatch.

Seems like a heck of a lot of work for an uncertain outcome - maybe it's less effort to just wipe, flash the new ROM and start configuring?
 
Upvote 0
thanks a lot for the extremely thorough reply! I am pretty comfortable with Linux so all that makes plenty of sense and most importantly it doesn't sounds like it will take up much of my time. I'll give it a shot tonight...check that...tomorrow night. Need to watch the Celtics handle business tonight!! :D
 
Upvote 0
thanks a lot for the extremely thorough reply! I am pretty comfortable with Linux so all that makes plenty of sense and most importantly it doesn't sounds like it will take up much of my time. I'll give it a shot tonight...check that...tomorrow night. Need to watch the Celtics handle business tonight!! :D

sublimnl,

The more I look into this, the more it appears that there are all sorts of opportunities for problems.

I'm not completely sure how Android assigns (native Unix) uids (app_1, app_2, etc) to the data areas (/data/data/com.*) for each app, so there is a chance that there will be uid/gid mis-matches between the /data partition from the old ROM to the newer one.

The Amon_RA recovery has a menu item for this (under "Other"), but I'm not sure if this is exactly the problem it is trying to fix up or not. I need to find some docs for that function, or see if I can find the sources somewhere.

Also, it does seem like it would be a good idea to delete the contents of the /data/dalvik-cache folder (or use the Amon_RA wipe Dalvik menu) after the restore - Android will recreate all those .dex files as needed, and then you will be certain that they were generated from matching app (.apk) files from the newer ROM.

Please post up your results, even if they fail miserably - I am curious to hear how it goes.

BTW, You could try Caddyman's suggestion (w/ Titanium backup), but you will need to restore the old ROM from it's Nandroid backup, and get "su", "SuperUser.apk", and Titanium backup installed on the old (rooted) ROM, and make the Ti backups, so you can restore them on the new ROM.

eu1
 
Upvote 0
Update: The "fix apk uid mismatch" menu item changes file permissions in /data/data for app settings by looking at a specific file ( /data/system/packages.xml ) which gets re-generated on every boot.

That means that for the particular scenario you are looking at, you would have to:

- Wipe and install the new ROM
- Boot the new ROM (so that /data/system/packages.xml is generated) with the SD card present (if you are using apps2sd).
- Shut down and go back into recovery.
- Make a backup copy of /data/system/packages.xml
- Restore your (saved) data.img Nandroid image (as previously discussed)
- Replace /data/system/packages.xml with the file you backed up.
- Wipe the Dalvik-cache (Amon_RA menu)
- Run the fix .apk uid mismatch function (Amon_RA menu)

Reboot.

This sure seems like a lot of effort, and you probably will still have problems with certain apps.

A fresh install looks more attractive every minute. ;)

eu1
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones