3

I want to check and play with different ROM's at my mobile phone. My phone is unlocked and rooted.

Here is scenario:

  1. I installed LineageOS 17.1(microG) and made backup using TWRP. I check all options for backup except cache(boot, data, recovery,system, system image,efs)
  2. Next I want to install Ubuntu Touch custom ROM and I will make a backup.
  3. Then I will install /e/ foundation OS ROM and I will make backup.

Questions:

  1. What would be good practices for making backups and restoring if I want to play between those systems recording all the changes at ROM(new apps,settings) along the way?
  2. Let's say I want to back to Ubuntu Touch ROM from /e/ ROM. Which minimal options at TWRP backup should I check to get my previous state(fully functioning) at Ubuntu Touch ROM?
  3. Should I back up all options at TWRP all the time?

Remark:

I don't expect LineageOS apps works at UbuntuTouch nor /e/ OS. I will install apps separatelly for each ROM. There is no need to share data between ROM's although if it is possible let me know.

1
  • make sure to set backup location external MicroSD Card and use latest TWRP for backup Internal Storage – alecxs Nov 19 '20 at 11:01
4

Without getting into specifics of which ROM you are currently using and which one you want to flash, TWRP isn't a good idea. Reasons :

  • TWRP is used to make a nandroid image and as you can see from the nandroid tag wiki help, you may run into serious issues if the directory structure of the ROM is different. Restoring a section of TWRP backup may also cause problems (read the linked page for details).

  • What may be a user app in one ROM, may well be a system app (having elevated privileges) and this may cause trouble.

  • Google dependencies : You may be running Gapps on Lineage and this may not be possible in other ROMs.

  • I am not familiar with Ubuntu but I doubt you would be able to run most user apps from LineageOS on that.

There would be more reasons, but these occurred to me on reading your question. You are better off making individual backups of apps using and restoring these as per your need.

Recently, I was doing some research on backup apps since Titanium failed for me on Android 11,and I came across this app, specifically designed for frequent ROM flashers and this may fit your need better. See Migrate-custom migration tool

Move apps, data, contacts, SMS etc from one custom ROM to another.

Interestingly, it claims to restore app permissions too. XDA thread here and Telegram here. You need TWRP to use this app.

I haven't tried this app (don't need it) nor am I affiliated with it.

6
  • Thanks for answer. I don't expect LineageOS apps works at UbuntuTouch nor at /e/ OS. I will install apps separatelly for each ROM. I think you were considering deeper coorelation between ROM's which I don't need that much. – lluke Nov 19 '20 at 10:09
  • Yes, I am sure those apps won't work but mentioned it just in case, it helps, if not for you, for future readers. Basic point is TWRP isn't a good tool for this purpose – beeshyams Nov 19 '20 at 10:37
  • @beeshyams wasn't there an option in TWRP to perform full filesystem image backups instead of "content backups"? And apart from that, if wiping the corresponding partitions before restore, would your arguments still hold true? To my knowledge, scenarios like this should be covered by Nandroid backups – be it disk images or "just contents". – Izzy Nov 19 '20 at 11:42
  • 2
    Disk/partition image backup option in TWRP is available for /system and /vendor (or maybe /odm, /product etc. too) so that dm-verity don't break, but not for /data (at least I'm not aware of) as it would require a larger SD card to save the backup. But backing up and restoring partition images is very simple. dd or adb pull/push should work. But backing up filesystem contents won't be a problem either as OP wants to restore the whole ROM backups (including /data). – Irfan Latif Nov 19 '20 at 12:18
  • 1
    @Izzy you may please proceed with the answer. – Irfan Latif Nov 19 '20 at 13:49
2

Your approach should work if you wipe partitions before performing the restore. By default, TWRP performs "file-based backups" (think of "a tarball of all the file systems") – so if the target storage is empty, the restore should be fine.

TWRP also offers "image copies", but as Irfan Latif pointed out probably not for all file systems. You could also create file system images using dd when booted to TWRP (backing up a "live system" leads to inconsistent backups as the file system changes while being backed up – always make sure that does NOT happen; booting to recovery is one way to ensure that). Those images you could store to the SD card – or directly write them off-device to your computer.

Shameless self-promotion: For the dd approach, you might wish to take a look at my tool Adebar – which would create you the needed backup script, pulling images of all partitions directly to your computer (you will want to modify the generated script to restrict it to the partitions needed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.