[HOWTO] Backup and Restore Data on Android Devices

In fact, it’s not clear to me :frowning:
The “What should I backup” doesn’t mention the /data/media partition.
Maybe is it included with latest versions ?

I have a device with TWRP 3.4.x, I’ll make some testing ASAP and post back.

Take screenshots where possible…we update all to the main guide.

First of all, thank you very much for this HOWTO.

Just to support @smu44 's point of view: my aim is to have a complete (and by complete, I mean a full backup, not a partial one, where a part of my information stored in the device is not included) image of the system, just in case something goes wrong while updating /e/OS. And, as @smu44 said, the documentation from TWRP is not clear enough to the unexperienced newbie I am… let alone that A/B slots that my device seems to have…
Is there a simple way to have such a complete backup, even better if saved externally? Not having had such a parachute (or having one beyond my possibilites/skills/knowledge) is what refrains me from updating /e/OS …

Thank you in advance

3 Likes

I just made a TWRP backup of my /e/ Pie santoni test device, using TWRP 3.4.0.0.

It’s now clear that it won’t include user data :


And, while backup is running :

But that’s absolutely no reason to give up on TWRP, which is an excellent tool.
Instead, I think we should try to complement it with a simple solution for backing up user data.

The most obvious (and probably the easiest for beginners) solution would be to copy the files directly to a PC :


However :

  • this method cannot ensure a complete copy (hidden/locked files)
  • this method won’t copy some extended attributes (access times, rights, selinux, …)
  • as Android is to be running, some files may change during copy

I know a method involving GNU tar instead of TWRP’s (busybox), but it’s not meant to be use by beginners as it is far from straightforward :frowning:

So, what ?
the method or tool has to be :

  • easy to use
  • sure (in terms of content reliability)
  • usable from TWRP (to address content volatility and crash-recovery full restoration)

When I’ll have some free time, I’ll give “adb backup” (from TWRP) a try …

5 Likes

You don’t need Android for this, TWRP supports MTP mode, so you can copy the Internal Storage via a USB connection while TWRP is running.
In case the computer doesn’t recognise it right away, TWRP has buttons to switch MTP off and on.

2 Likes
2 Likes

You’re absolutely right ! :slight_smile:
I completely forgot the TWRP MTP mode, shame on me.

So, one of the 3 problems is solved :+1:

yes, you’re right again !

But … as far as I know, problems only happens for direct-to-PC backups, am I right ?

Also, a point of attention that I forgot to mention : TWRP backups may fail when Magisk or Shelter are installed (giving a unclear “error #255” message …).

So we may add, as a per-requisite to the HowTo, to uninstall them.

1 Like

Thank you for pointing out. As I have installed Shelter, I understand this is making it even more complex …

There once was a promising app called Tipatch (Play Store link) that would patch TWRP to also backup internal storage.
Last updated back in 2018 so I figure it might not be useful/usable in this age of A/B twrp-is-part-of-boot-image devices.
But for “legacy” devices it may be an option, especially if one’s TWRP doesn’t have the ability to create a system image (a feature I have yet to try).

EDIT: Oops, I forgot it is also on F-Droid.

1 Like

Thanks @marcdw, very interesting ! :slight_smile:

F-Droid link is not working, however I could find the dev home kdrag0n and the xdalabs link.
Unfortunately, last post in xda-devs thread reports it is obsolete with TWP 3.4 :frowning:

However, browsing the xdadevs thread, I found something interesting. Also flagged as obsolete, but may lead to a solution … currently investigating !

Edit : hack above is not a solution for us, as it involves patching TWRP image.
I found some “newbie-proof” solutions, involving temporarily renaming the “media” directory : here and here.

2 Likes

Hi,

I’ve made some testing here, none of my Shelter-enabled devices show the error.
So I think it’s worth a try :slight_smile:

Hi @Manoj !

I’ve tried to add some improvements to the HowTo, please feel free to roll them back or ask me if unclear.

2 Likes

Thanks for the updates @smu44… that is the whole point of having these editable documents so that all users can add edit and update as per their own findings.

2 Likes

Hello,
I had TWRP on my FP2 and I guess the installation was easier back then, because now with my FP3+ I am struggling to install it. Even reading a couple of guides and explanations, like this topic, this or this, I am not prepared to make it. Can you recommend a more detailled step-by-step installation guide for “beginners”? Thanks!

Why do you want to install it? Just because you had it on the Fairphone 2? For your consideration …

https://forum.fairphone.com/t/used-to-the-fairphone-2-dont-do-these-fairphone-2-things-on-the-fairphone-3/57721

3 Likes

Thanks for your quick reply!

As I did with my FP2, I´d like to use it to create backups like every three months or so, to be prepaired for eventual phone loss or destruction.

Thanks for the link, I like the diclaimer which definately excludes me :grin:
Don’t install TWRP on the Fairphone 3 before you really know what you are doing

I also don´t feel comfortable with the whole fastbood/adb topic, so I guess I´ll just live without backups.

2 Likes

Possible, if you’ve got no important data on the phone ever.
But before giving up you might want to have a look at regularly syncing things like messages, contacts, photos and the whole Internal Storage to a computer, e.g. with MyPhoneExplorer. That’s not difficult … How To and FAQ.

3 Likes

Hi everybody,

A little contribution from another newbie on /e/.

I think Smu44 touched a relly sensible keypoint. An easy user procedure for Data backup that allows to put your data wherever you want (cloud, pc,usb, etc) is one of the feature that make worthable the choice.

It could be spendable as well from a marketing point of view, remarking the security framework for degoogled OS.

I think a programming task than can be rewarded a lot in term of reputation.

3 Likes