Complete backup tools: TWRP adb and others?

Hi there,

I once tried FP Open OS on my FP2, but out of laziness to keep everything updated, I reverted to the stock version, which does not come with a nice backup tool apart from using Google tools. Actually I’m half way from Google, having a Google ID just to get stuff from the Play Store, but nothing like saving anything else with Google. For calendar and contacts, I’m syncing things up using Davdroid and a Fruux account.

This said, because I experienced several issues with FP2 devices before, I’m keen to make full backups before any OS update. I have several questions here.

  1. I tried the command line adb tool with “adb backup -f mybackup.ab -apk -obb -all” which gave me a 700M file, but I’m not sure what is really in
  2. I read some of the threads concerning TWRP, especially Recover/backup user data (FP OS and FP Open OS)but couldn’t find out if it was possible to install it on a stock FP2 to replace the stock recovery. Today, I unzipped the latest FP Open OS, grabbed the recovery.img in there, and in fastboot mode I tried “fastboot boot recovery.img”. But I got an error saying that it wasn’t signed. Then I tried “fastboot flash recovery recovery.img”: no error, but when trying to boot into recovery, it appears that it is still the stock recovery… Same when trying “fastboot erase recovery”, it does not erase anything… Any clue about replacing the stock recovery with TWRP ?
  3. From the TWRP doc, I understood that the user part of the data partition was not saved, and that this had to be done manually, by connecting the phone to a computer and copying files.

My wish would actually to have a “cloning” tool, so that I could easily make a backup (one or several files) that would be sufficient to recreate an exact replica of my phone and all its data and apps, in case the update would fail to the point that the phone gets hard bricked (which I experienced last July…).

Many thanks !

  1. adb backup doesn’t perform a full system backup, I think all apps and settings are inside the archive (I actually don’t know which files are inside, it didn’t work for me), so I think this is not what you want.
    2)[quote=“Lomig, post:1, topic:23568”]
    “fastboot flash recovery recovery.img”. But I got an error saying that it wasn’t signed.
    [/quote]

This is the way to go (And how it worked on my phone). But maybe you typed fastboot boot recovery.img instead of flash recovery?! I think the signature is only needed for booting.

  1. Inside TWRP, you can choose which partitions you want to backup. I just did that today, but I’m not sure /data was there, but I expect it’s there (otherwise it would’t make much sense?).

Thank you, but still not able to run TWRP, see my edits in item #2

It’s generally confusing for others, if you edit your original question I answered to. :wink:

OK, I don’t know this behaviour from FP2 but from other Android Smartphones (i actually can’t remember how i did it), but I think a fastboot reboot recovery right after the fastboot flash ... should do the trick, because the Android system could re-flash stock recovery unless TWRP prevented this, and this is why it needs to be started before the next Android start.

This is exactly how I understood TWRP’s backup-function :wink:

I understand the idea, but it seems that “fastboot reboot recovery” is not a correct fastboot command: I get the fastboot help screen when typing it…

I also tried this:

not waiting until the full boot to run the adb command, but it’s still launching the stock recovery…

ok, sorry, i wasn’t aware of that. then use fastboot reboot while pressing VOL+.

Yes, because the recovery replacement is way before adb is working…

1 Like

I really don’t think FP OS is replacing the recovery partition on boot… my brother used FP OS with TWRP for some time without troubles, before changing to FP Open.

Yes, maintaining Vol + after launching fastboot reboot should work.
Make sure you are flashing the right recovery.img (the one from FP Open) with fastboot flash before that.

If that don’t work again, contact support, because your FP2 is not flashing images the right way.

Yes, TWRP is a “clone” tool. I use it when i want to test ie sailfish, and then return to my everyday OS. Very useful, since other solution perform incomplete backups.

To my knowledge, you can do a “fastboot flash recovery recovery.img”. Are you sure you took the correct TWRP recovery image ? In case of doubt, you can try the community compiled version here : ✏ Porting TWRP recovery

If for any reason you don’t want to flash, only to run it, then you’re supposed to use “fastboot boot …”. But this one doesn’t work, it requires the image to be signed. @retsifp found out how to perform this signing, see here : https://forum.fairphone.com/t/fastboot-boot-is-broken/23235/2

I know this behaviour from some Samsung phones, there TWRP needs to be booted before the first Android start in order to patch the OS (preventing it to replace the recovery).
This is just a idea how TWRP could get lost, but I don’t have a better one :wink:

This is absolutely true, but I don’t think the bootloader is defective, since the phone and the recovery is working as intended…

This is also true, and I wanted to do this for a long time :smiley:
Here is the signed image (it’s the recovery.img from FPOOS 16.10), I tried it with my phone, it worked just great! :slight_smile:

So maybe it’s an option for you to try TWRP without flashing it :wink:

Edit: To check the files, you can verify the fp2-sibon-16.10.0-orig-recovery.img by comparing it with the one inside the fp2-sibon-16.10.0-manual-userdebug.zip.

to compare the differences between the original and the signed one, you can use vbindiff:

vbindiff fp2-sibon-16.10.0-orig-recovery.img fp2-sibon-16.10.0-signed-recovery.img

Here is an example output:


(The signature is appended to the original file)

Thank you so much for all your replies and links, I think I figured out what happens on my FP2. This is what I did to sort it out.

First, I tried the signed image from @retsifp, without flashing it, using fastboot boot fp2-sibon-16.10.0-signed-recovery.img.

It launched TWRP nicefully.

Second, I flashed the original recovery.img from from FPOSOS 16.10, using fastboot flash recovery recovery.img (by the way I don’t get the reason why you can flash an unsigned image, but must get a signed one for just running it). Then I did not let my phone reboot into FPOS, instead, I pressed Vol + and power, until it directly rebooted into TWRP 2.8.7.0.

Third, I rebooted my phone to FPOS, and then tried to get back to recovery mode, using adb reboot recovery. The phone booted into the stock recovery of FPOS 1.8.1…

Fourth, I erased the recovery using fastboot erase recovery and pressed Vol + and power to try to boot recovery: I only got the Fairphone black boot screen, and using fastboot devices, it appeared that my phone had actually rebooted in fastboot mode, as no recovery was present.

Fifth, I did as third, and got the same result.

So from this, and from your good advice, what I can tell is that:

  1. when booting, if the recovery partition contains nothing or another recovery tool, FPOS 1.8.1 just replaces it with its stock version.
  2. this was probably the same in previous versions of FPOS, at least from 1.4.2 as I can remember trying to install TWRP unsuccessfully at that time.
  3. as @retsifp says:

I’ll stick to boot TWRP from a signed version when I need it, especially before any Fairphone update.
4. adding fastboot the option to reboot into recovery, which it not currently possible (at least on FP2), would be a nice to have: fastboot reboot recovery

Thanks again !

1 Like

So @retsifp was right after all! It must be included in some of the latest versions, then. And I don’t think it’s a good idea, of course.

Unviable because of a few reasons, but mostly because that little change would mean Fairphone should distribute its own version of fastboot (fragmentation, uuugh). Although there’s maybe a middle solution with the fastboot oem subcommand, but I’m not sure about this.

1 Like

Of course, it doesn’t do image backups of the system and data partition, but apart from that it’s quite extensive - as far as I understand it and from my own experience. Namely, I think

adb backup -f <filename> -shared -apk -all

will backup all your apps’ apks, apps’ data (including system apps), your settings and the internal storage, hence your user data (photos, videos, music etc.). What it doesn’t backup is calendar data, contacts, phone call history and sms (which surprisingly seems problematic in general for other complete backup solutions as well).

I use it as one backup option (not the only one) and it works. I wouldn’t completely rely on it and it is in fact not a 100% reliable, but it’s also not that worse and I’m glad to have it as an option.

By the way, what does the -obb option do?

OBBs are APK expansion files. Usually you can find them for games or really big apps that require a lot of graphic resources.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.