[HOWTO] Backup and Restore Data on Android Devices

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.



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.


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.


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 …


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.


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.


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.


I think the devs are working on including seedvault into /e/ (see these issues on the gitlab).
This does full backups of all application data.
@Manoj any status updates?

It doesn’t, apparently.

Oh, that’s bad.
Do you know of any list of apps that work with seedvault?
I’d assume most apps from f-droid should work, because that’s Calyx OS’ main app store. This would still cover (hopefully :wink:) most apps you use on your /e/ phone.

As this thread is an HowTo for TWRP, discussing additional software may be out of topic :wink:

In the HowTo I tried to provide an MTP solution (within TWRP), but it may not work on some devices.

One idea could be to provide users with a TWRP-installable zip, containing all necessary stuff (binaries, script) to help user backup their data as a complement to TWRP’s.

Thank you for your feedback.
Personally, I would like to have a tool that is newbie-proof… you hit a button, you get the backup, and after the update of the OS, you restore, and that’s it … I would not mind if it is something to be done with adb, but I would really like one command only, without having to be afraid of having lost something or not to be able to recover…


Thanks @smu44 for pointing out this problem with Shelter. On my OnePlus 5T I had it installed with Magisk after an upgrade to the Pie build. Under Oreo before I didn’t have this problem and Nandroid would backup with no problem but it appears the multiple user accounts feature frequently blocks TWRP backups which end with “error 255”. I had made the mistake of installing Shelter but when I realised this was the cause and so uninstalled it, the blocked Nandroid backup was still there. I tried several of the suggested solutions to no avail until I came across a tip from user Pannal on the github site of TWRP. He has created a flashable file - RMDAD_v0.0.1.zip which removes the instances of multiple accounts and once I had flashed it my codeworkx version of TWRP worked perfectly. It was only the /data partition that caused the problem as the others backed up with no problem.
I have since tested my Nandroid backup of /boot, /system & /data by doing a restore and it worked perfectly to my great relief, as I now have a reliable backup method. The presence of my Magisk mod to get root doesn’t seem to affect anything, which is just as well since I use Titanium Backup to safeguard my user installed apps and as you probably know it only works on a rooted device.
I hope my experience will be useful for those running into this error 255 problem as it seems to exist on other devices as well. Lesson learned: Don’t install Shelter or use multiple accounts!


Thank you very much for sharing this hint. It seems very interesting to me …
I had not checked that before, but perhaps it could be useful (and easy) to have the backup of the data …

Any feedback from users?

Thank you in advance

Thanks @Grendel for your feedback :slight_smile:

I’ll try again on my TWRP 3.4 devices with Shelter, last time the error didn’t show …
But I’ve seen it in the past, with Shelter and/or Magisk.

The data partition problem with multi-user enabled makes sense, but it could have been fixed in latest TWRP.

So we could assume that this error could be related to :

  • device
  • ROM
  • TWRP device-specific build
  • TWRP version
  • Shelter and/or Magisk installed

Too much criteria to diagnose :frowning:

I agree with your conclusion : better stay away from Shelter, and I’ll add : maybe from Magisk too !

Or, on some other hands : if your TWRP backup fails with error #255, remove additional profile and Shelter, and retry ! :smiley:

After some tests on 2 devices (Lenovo YogaTab 3 and Xiaomi Redmi 4X), I come back to propose some adjustments. I could restore from a corrupted ROM image using this method.

I’ll be very grateful if somebody with a testing device or similar experience could confirm, so we may evolve the HowTo :slight_smile:

1/ Restore

  • Unless necessary, only restore the specified partitions, even if more are included in backup. I tried to restore others (EFS, persistent, recovery, images), every time my device rebooted abruptly in fastboot and eventually I had to reinstall TWRP.
  • It is safer to restore /data/media before first system reboot (see below for backup). If you used a tgz archive, something like cd / then tar -xzvf /path/to/backup/storage/data_media.tgz. Also don’t forget to check owners and use chown -R user:user * if necessary.
  • Before first reboot to system, you may want to remove /data/system/locksettings.db (or similar). If your device was protected by pattern/pin/password, you may not be able to unlock while rebooted in system.
  • Proposed sequence :
    • reboot to TWRP with backup files available
    • format data
    • restore boot/system/data
    • restore data/media from hand-made archive
    • delete /data/system/locksettings.db (or similar)
    • reboot system (Android may encrypt at first boot)
    • set lock (pattern/pin/password) again, and optionally activate Secure Boot
    • reboot again so system

2/ Backup

  • As a matter of precaution, I strongly suggest to remove any lock in Security before backup (don’t forget to reboot to system to check). You will lose your fingerprints records.
  • If your phone has secure Boot activated (prompting at boot with black background), it may persist even after removing lock (it happened to me …). You can try the following :
    • set lock to pattern, activate Secure Boot, reboot system
    • set lock to swipe, reboot system
    • set lock to none, reboot system
  • Boot to system or TWRP should not require any code/pattern/password, Files app should show your files.
  • As suggested in previous posts, uninstall Magisk and Shelter.
  • I also advise to make a gzipped tar backup of /data/media while in TWRP :
    • do the TWRP backup, do not reboot
    • from an adb-enabled computer, launch an adb shell (as always, adb devices first, if no device shown you may have to play with MTP in TWRP Mount)
    • Alternatively, you can use the TWRP Terminal.
    • identify a target storage (for example, you can use the mount command to find path to your SDCard)
    • launch cd / then tar -czvf /path/to/backup/storage/data_media.tgz . (note : some TWRP may have zip, bzip2, GNU tar, … I’ll stick on ToyBox/BusyBox tar as it seems to be widely available)
    • also record owners using ls -l /data/media > /path/to/backup/storage/data_media_owners.txt
  • On my Lenovo YT3, TWRP backup to SDCard never succeeded (stuck somewhere in middle of nowhere). I could use an USB OTG, but it was much slower as internal storage.
  • In any case, take the time to copy your backups to another storage (PC). You may have to move files to /data/media/... if using internal storage, before rebooting to system.
  • If enough space is available, feel free to backup more partitions. But be aware that only some can be restored without using any “magic”.
  • Have the TWRP image file on hand, just in case …
1 Like

The latest version of TWRP is: