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

Root [GUIDE] to Retaining Data After Flashing a New ROM

Artine

Android Expert
Jul 20, 2012
1,304
585
The Moon
Since it doesn't appear to be widely known (and this is mostly for Newcomers, but could be for Veterans as well), most of us believe that you have to lose your data when flashing a new ROM in order for it to work properly. And, to top it all off, trying to restore anything with Titanium Backup post-new-ROM-flash doesn't appear to work correctly for most of us either. And, if you don't format/wipe /data, then your phone could likely get into a bootloop or have other weird issues.

There is good news, however, as there is a way to circumvent these problems and inconveniences. The following applies to all ROMs, but only if your flashing a ROM for the first time or are changing from one ROM to another. This also only applies to like-for-like Android versions; in other words, Gingerbread -> Gingerbread, not Gingerbread -> Ice Cream Sandwich. If you're merely updating your existing ROM to a newer build, you can completely ignore this Guide entirely as your data will be unaffected since you don't have to format it for an update:
  1. Take all necessary steps to prepare for flashing your ROM of choice.
    • Such as wiping the /cache and dalvik-cache, making a Nandroid backup, and then wiping /system and /data in CWM.
  2. Flash the ROM in CWM, as usual.
  3. In CWM, select the Reboot Recovery option, located under Advanced in the Main Menu, to reboot the phone with the new ROM installed, but right back into CWM.
  4. From here, go to backup and restore -> advanced restore -> choose your most recent Nandroid backup from the list -> then choose Restore data.
  5. Head back to the main menu of CWM, and wipe/format the cache.
  6. From the main menu of CWM, go to Advanced -> Wipe dalvik cache.
  7. Next, from the Advanced menu in CWM, go to Fix Permissions.
  8. Head back to the main menu of CWM and select reboot system now.
  9. Your phone will have the new ROM installed, all of your data has been retained, and the ROM and phone shouldn't have any problems.
 
Artine,

thanks for this info. does step 1 affect the data on the external SD card at all? I assume not considering that's where I assume the nandriod backups and such are placed?

Would step 7 be use Titanium Backup to restore your apps?

thanks,
Bob

No, neither SD card is touched. Just the /data partition.

That's why there's no step 7. You shouldn't be using Titanium Backup to restore anything after switching to a new ROM - it's a known problem that the restoration doesn't work and cause/will cause problems. Also, once your data has been restored, there's no need to use Titanium Backup for anything post-new-ROM, because all of your data has already been restored :)
 
  • Like
Reactions: PilotBob
Upvote 0
After flashing this ROM when I choose reboot device in CEM I get the prompt:

ROM may flash stock recovery on THIS CAN NOT BE UNDONE. Do I chose yes or no here?

Flashing which ROM? Stock? If it's prompting you for Sleipnir, it's fine. The install-recovery.sh script was modified to provide partial functionality for init.d scripts, and as that's the only code in the file it won't cause CWM to be overwritten with the stock recovery.
 
Upvote 0
Flashing which ROM? Stock? If it's prompting you for Sleipnir, it's fine. The install-recovery.sh script was modified to provide partial functionality for init.d scripts, and as that's the only code in the file it won't cause CWM to be overwritten with the stock recovery.

Sorry, thought I put this in the Sleipnir thread so yes.

Should I answer NO or YES to this prompt? I've been answering NO and so far so good.

BOb
 
Upvote 0
I didn't answer anything, just pressed the back button when confronted with the "yes or no" choice and the phone rebooted. My data was saved, but Sleipnir kept re-booting every few minutes, so I've decided not to keep my data and just re-flash it clean. My phone had re-booting issues with past versions of Sleipnir, but I'll give a clean install a try before going to Harmonia.
 
Upvote 0
Sorry, thought I put this in the Sleipnir thread so yes.

Should I answer NO or YES to this prompt? I've been answering NO and so far so good.

BOb

You can hit yes and CWM will not be overwritten, as there's nothing telling it to be overwritten.

I didn't answer anything, just pressed the back button when confronted with the "yes or no" choice and the phone rebooted. My data was saved, but Sleipnir kept re-booting every few minutes, so I've decided not to keep my data and just re-flash it clean. My phone had re-booting issues with past versions of Sleipnir, but I'll give a clean install a try before going to Harmonia.

There's a known cause for that, which is either that data was not wiped before switching ROMs, or the phone is unstable while overclocked. I would suggest doing a clean install, which is done by first verifying that the build is correct for your carrier, the MD5 matches what it should, and making a Nandroid backup after wiping the /cache and dalvik-cache manually. Then wipe your /data, then flash the Sleipnir build. Then reboot back into recovery, and do an advanced restore from your earlier Nandroid backup, and restore only /data. Then reboot normally. Change the overclocked frequency of the CPU from 1.6GHz down to where the phone is stable, and you're good to go.
 
  • Like
Reactions: amaranthine
Upvote 0
There's a known cause for that, which is either that data was not wiped before switching ROMs, or the phone is unstable while overclocked...

Thanks for the instructions! I prefer starting over with a clean phone anyways. I was just trying out the restore data idea to see how it worked. I'll keep this in mind if I want to keep my previous data for a new flash.
 
Upvote 0
Just curious what issues people have with titanium on this phone? Been using it since... Well forever but with this phone since I've rooted and I've yet to have a single problem

Basically:
  1. Titanium Backup backs up apps and data on Harmonia (for example).
  2. Wipe /data.
  3. Flash Sleipnir (for example).
  4. Reboot and restore your apps and data with Titanium Backup.
  5. TiB fails, hangs, and/or causes other problems.
It doesn't seem to happen to everyone, but for a lot of people it ends up being the case. With restoring the entire data partition, however, you get everything back without the bootlooping or other problems.
 
Upvote 0
Basically:
  1. Titanium Backup backs up apps and data on Harmonia (for example).
  2. Wipe /data.
  3. Flash Sleipnir (for example).
  4. Reboot and restore your apps and data with Titanium Backup.
  5. TiB fails, hangs, and/or causes other problems.
It doesn't seem to happen to everyone, but for a lot of people it ends up being the case. With restoring the entire data partition, however, you get everything back without the bootlooping or other problems.

Strange, sounds kind of like what would happen if you try to restore system data and not just personal
 
Upvote 0
It might be good to note that this method doesn't always work when restoring data from a rom that's based on a different version of android; from GB to ICS for example. In my experience, even from different AOSP roms based on the same android version. I'm not sure how far apart two roms have to be for these problems to start, but it's best to be aware. I think it's best to first start up a new rom without restoring data, to make sure everything works.
 
Upvote 0
It might be good to note that this method doesn't always work when restoring data from a rom that's based on a different version of android; from GB to ICS for example. In my experience, even from different AOSP roms based on the same android version. I'm not sure how far apart two roms have to be for these problems to start, but it's best to be aware. I think it's best to first start up a new rom without restoring data, to make sure everything works.

That's a good point, and I have updated the guide accordingly.

It is also good to wipe dalvik cache after you restore your data

Also a good point, and the guide has been updated with that note as well.
 
Upvote 0
Tried the exact steps after installing Sleipnir but somehow i get reboots constantly after i update the data. It boots into sleipnir and takes a long time and then when it boots into the main screen after a few minutes boots back again into Sleipnir screen.

Maybe doing something wrong but clarification might help out

Head back to the main menu of CWM, and wipe/format the cache.
In this do you mean wipe cache in the main menu and then go to mounts and format cache there?

Head back to the main menu of CWM and select reboot system now.
when i reboot system it asks something about recovery flash, should i be saying yes to this?
 
Upvote 0
Tried the exact steps after installing Sleipnir but somehow i get reboots constantly after i update the data. It boots into sleipnir and takes a long time and then when it boots into the main screen after a few minutes boots back again into Sleipnir screen.

Maybe doing something wrong but clarification might help out

Head back to the main menu of CWM, and wipe/format the cache.
In this do you mean wipe cache in the main menu and then go to mounts and format cache there?

Head back to the main menu of CWM and select reboot system now.
when i reboot system it asks something about recovery flash, should i be saying yes to this?
Perhaps reflash and give this a shot.
 
  • Like
Reactions: Dark One and redace
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