✏ How to backup your internal storage through a TWRP backup

This post is a #wiki. You can edit it using the green pencil button :pencil2: if you want to add something.

This wiki can be followed by the tag #twrpstoragebackup.


Why this wiki?

TWRP is a #dic:customrecovery, and it allows to do a Nandroid backup, i.e a complete backup of all the data on your phone, the system, the apps, though it does not back up your internal storage. All the files in the internal storage will not be saved, and you have to do it manually if you want to. This guide works around this and will allow you to save your internal storage with the rest of your phone.

Disclaimer: This procedure may break things on your phone. Following the steps carefully as said here should work, but if you have a doubt, ask the question on the forum.
Even when following the steps properly, it seems that a too full storage can create problems. It may not work 100% of the times (I @Alex.A have had no problems, but know someone who did, showing a backup size bigger than the FP2 storage size).

1. Do the backup

Here’s how to do the backup containing the internal storage.

  • The first thing you will need is TWRP on your phone. Please #installtwrp or boot it via fastboot boot <twrp.img> (see #twrpwoflashing)

  • AdvancedFile manager

  • Open the folder /data/media

  • Press the little blue folder button, and choose Rename Folder

  • Rename the folder by another name, for example mediabak

  • Come back to the home TWRP, tap on Backup, select the Boot, System and Data partitions (it says it excludes storage, but thanks to our workaround it does) and backup on a micro-SD card (it will always be better to back up on the micro-SD card if ever you have problems with your phone). Once the backup is complete, don’t reboot!

  • Come back to the TWRP home screen and open the File manager in AvancedFile manager

  • Open /data/mediabak/ (or the name you gave to the folder when you renamed it), press on the blue button in the corner and rename it to media (otherwise you might have problems when you reboot your phone)

2. Restore the backup

Be it later when you fiddled with your phone or on a second identical device, you’ll have to restore the backup. Here’s how.

  • Start TWRP

  • WipeAdvanced wipe

  • Select Dalvik, System, Cache, Data and Internal Storage and wipe

  • Restore the backup in Restore. Choose which backup you want to restore and swipe

    • NB: If your backup is a LineageOS 17.1 one, when restoring it, please install the system anew before restoring only the Data partition (don’t reboot in between). The restore of the system is broken in LineageOS 17.1 and will result in being stuck on the boot screen. You can find here how to install LineageOS 17. on FP2. Then continue with the next steps before rebooting.
  • Go in the file manager (Advanced wipeFile Manager) and open /data/media

  • Press on the blue button, select Delete, confirm

  • Go in the file manager as said above and open /data/mediabak (or however you named it when you did the backup)

  • Press the blue button and select Rename Folder

  • Rename it to media

  • Reboot

That’s it, you have restored the backup with the internal storage :slightly_smiling_face:

 

 

Alternative solutions

An alternative might be to use a tipatch patched TRWP.

8 Likes