• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE] Backup / Restore function in Poco X3 recoveries [OrangeFOX / TWRP]

Search This thread

jeryll

Senior Member
Dec 23, 2010
861
688
Realme GT
Preliminary guide to BACKUP / RESTORE with
OrangeFox recovery by ManoloRey

LINK
or
TWRP recovery 3.5.X_10-x by brigudav

LINK

! ! ! USE ONLY LINKED VERSIONS OF RECOVERIES ! ! !

Consider this guide for (decrypted vendor (or encryption disabler) + decrypted storage used) as BETA, I don't recommend backup/restore procedures with OrangeFox recovery Beta or TWRP 3.5.0_10-x for actual backups of your data (TRY THIS ONLY AT YOUR OWN RISK) ONLY FOR TESTING / EDUCATIONAL PURPOSES !

Do not ask for help if your data have been lost because they can't be restored, or suddenly your backup - successfully restored several times before - now can't be! This is still buggy and sometimes for unknown reasons restore of your data can fail ! Restore process always worked 100 % for me, but results sometimes differ !


YOU HAVE BEEN WARNED!

(decrypted vendor (or encryption disabler) + decrypted storage used)
- backup boot and data partition

Restore:
- wipe cache, dalvik, data
- flash ROM + GAPPS that you have installed when you created backup
- restore backup of boot and data partition
- remove Android password (OFOX recovery functionality) restored from backup either directly after restore or later from the menu with OFOX addons (the file PassReset.zip MUST EXIST in this location: /storage/emulated/0/Fox/FoxFiles/ for this to work !) but before reboot!
- in case you lost your OFOX addons thanks to format data or you are using TWRP 3.5.0_10-x, you can also directly delete all file(s) in /data/system which starts with locksettings* = remove password
Reboot

Comment(s):

- if you remove your password/PIN/pattern protection directly before backup you can end up after restore with system where you can't change your password/PIN/pattern anymore

- if you forget to remove your password/PIN/pattern protection AFTER RESTORE you can end up after boot with system demanding to enter your password/PIN/pattern which MAY or MAY NOT BE ACCEPTED even if it is CORRECT and maybe INACCESSIBLE because of that

- Google Pay will never be restored properly (or anything depending on actual password in time of backup), because of the removed password, you will need to set up it again after restore
- backup super, boot, dtbo and data partition (metadata partition is optional)

Restore:
- wipe cache, dalvik, data (optional)
- restore super, boot, dtbo and data partition (metadata partition is optional)
Reboot
(everything will be restored to the state in time of the backup) ¹)


- if needed remove Android password (OFOX recovery functionality) restored from backup either directly after restore or later from the menu with OFOX addons (the file PassReset.zip MUST EXIST in this location: /storage/emulated/0/Fox/FoxFiles/ for this to work !)
- in case you lost your OFOX addons thanks to format data or you are using TWRP 3.5.0_10-x, you can also directly delete all file(s) in /data/system which starts with locksettings* = remove password

Comment(s):
¹) your backups will be fully restored along with password/PIN/pattern and fingerprints - this will work until you'll format data (or for something else that needs to be discovered yet), after that you'll loose the ability to use your password to enter the system and depending on ROM features you can either skip password entering with fingerprints (RRemix) or reset your password so you can enter the system (CrDroid), in RRemix everything works, except you can't change your password etc, in CrDroid you need to re-setup your password depending apps

- if you remove your password Google Pay will never be restored properly (or anything depending on actual password in time of backup), you will need to set up it again after restore
x x x​
(encrypted vendor and storage used)
Backup:
- backup boot and data partition

Restore:
If you are restoring a data backup of an encrypted device, there are precautions that you should take before starting the restore process (obviously, your backup must be on MicroSD or other external storage medium - NOT on the internal storage):
  • Format the data partition (NOTE: format - not just wipe)
  • Reboot OrangeFox / TWRP
  • Flash the original zip of the ROM whose backup you are trying to restore
  • Wipe cache and dalvik
  • Reboot to system to ensure that the newly-flashed ROM actually boots, and that it re-encrypts the device with its own encryption
  • Reboot to OrangeFox / TWRP
  • Tap on the Backup icon
  • Select the partition(s) that you wish to restore
  • Swipe to restore

  • If you do not follow all these steps, you can expect problems with restoring data
Reboot

Comment(s):
TBA

Credits: OrangeFox devs as this guide (for encrypted vendor and storage used) is copied directly from OrangeFox wiki slightly modified by me by adding "/ TWRP" to the text

this guide will be updated if I discover new facts or post new, updated steps or how-to's
 
Last edited:

Kherham

Senior Member
May 8, 2017
121
22
Joinville - SC
Thanks for this flashlight on the darkness.

Let me ask you a help. How can I decrypt my device? Wanna do it just like my old MI8, where I didnt need to do format data ever when go to update a rom.

Ever I go do recovery (OFOX or TWRP) I got this in screenshot.
 

Attachments

  • ecrypted.jpeg
    ecrypted.jpeg
    123.4 KB · Views: 162

jeryll

Senior Member
Dec 23, 2010
861
688
Realme GT
- download and flash decrypted (hacked) vendor from this thread or
- use encryption disabler zip, but that is a little tricky to use - you need to flash encryption disabler every time you update your MIUI base, or custom rom, if you forget that, on next boot your internal storage will be encrypted
- - to remove encryption from data partition after - you need to do initial format data (yes) - after that you can start to use wipe data if needed (some ROMs still need to use format data (yes) or they'll not boot - RR 8.6.6/8.6.7 for example)
 

pnin

Senior Member
Aug 26, 2010
613
255
ZTE Axon 7
Xiaomi Mi Pad 4
As this [surya] 'encryption-disabler-v1' is basically a shell script (pasted to https://paste2.org/804aemGx, BTW), I took the risk to flash it without formatting 'Data' -- only I disabled any security beforehand, i.e., no pin, password or fingerprint.

It appears to have worked, cause I rebooted into system with no issues. But how to verify?
 

jeryll

Senior Member
Dec 23, 2010
861
688
Realme GT
not sure what do you want to achieve by flashing of encryption disabler without actually disabling encryption by formatting your data partition...
so what do you want to verify?
if you start OFOX, on the initial screen you can see the state of your data partition (encrypted/decrypted)
 
  • Like
Reactions: Slim K

pnin

Senior Member
Aug 26, 2010
613
255
ZTE Axon 7
Xiaomi Mi Pad 4
Thanks for your patience. I was under the impression that if you disable security locks then you had no encryption and the script would just ensure it would remain so. By your reaction I'm assuming I was wrong...

Overall, I am just getting fed up with always having to format data and having to start from scratch.

I not longer have OFox, I'm currently running brigudav's TWRP "v3.5.0_10-5-surya".
 
Last edited:

Slim K

Senior Member
May 16, 2015
180
2
112
HTC One (M8)
Sony Xperia Z5
Thanks for your patience. I was under the impression that if you disable security locks then you had no encryption and the script would just ensure it would remain so. By your reaction I'm assuming I was wrong...

Overall, I am just getting fed up with always having to format data and having to start from scratch.

I not longer have OFox, I'm currently running brigudav's TWRP "v3.5.0_10-5-surya".
As you said, that encryption_disabler.zip is a shell script, which makes the folder in /product/vendor_overlay/29/etc and copies fstab.qcom from vendor to it. Then edits every line using the shell command sed (aka stream editor) that includes the string fileencryption= with the string encryptable=.

The above described process is usually done on the first boot of a newly installed ROM as is with every vendor_overlay entry in product (minus the edited strings ofc). Editing it after the ROM reads vendor fstab.qcom and encrypts the data partition is useless. However, formatting data (deleting keystore essentially) and flashing that .zip should also do the trick. Might as well update your base MIUI and ROM while you're at it :p
 

XtraWater

Senior Member
Apr 8, 2018
618
106
Samsung Galaxy S5
Xiaomi Mi A1
Preliminary guide to BACKUP / RESTORE with
OrangeFox recovery by ManoloRey

LINK
or
TWRP recovery 3.5.X_10-x by brigudav

LINK

! ! ! USE ONLY LINKED VERSIONS OF RECOVERIES ! ! !

Consider this guide for (decrypted vendor (or encryption disabler) + decrypted storage used) as BETA, I don't recommend backup/restore procedures with OrangeFox recovery Beta or TWRP 3.5.0_10-x for actual backups of your data (TRY THIS ONLY AT YOUR OWN RISK) ONLY FOR TESTING / EDUCATIONAL PURPOSES !

Do not ask for help if your data have been lost because they can't be restored, or suddenly your backup - successfully restored several times before - now can't be! This is still buggy and sometimes for unknown reasons restore of your data can fail ! Restore process always worked 100 % for me, but results sometimes differ !


YOU HAVE BEEN WARNED!

(decrypted vendor (or encryption disabler) + decrypted storage used)
- backup boot and data partition

Restore:
- wipe cache, dalvik, data
- flash ROM + GAPPS that you have installed when you created backup
- restore backup of boot and data partition
- remove Android password (OFOX recovery functionality) restored from backup either directly after restore or later from the menu with OFOX addons (the file PassReset.zip MUST EXIST in this location: /storage/emulated/0/Fox/FoxFiles/ for this to work !) but before reboot!
- in case you lost your OFOX addons thanks to format data or you are using TWRP 3.5.0_10-x, you can also directly delete all file(s) in /data/system which starts with locksettings* = remove password
Reboot

Comment(s):

- if you remove your password/PIN/pattern protection directly before backup you can end up after restore with system where you can't change your password/PIN/pattern anymore

- if you forget to remove your password/PIN/pattern protection AFTER RESTORE you can end up after boot with system demanding to enter your password/PIN/pattern which MAY or MAY NOT BE ACCEPTED even if it is CORRECT and maybe INACCESSIBLE because of that

- Google Pay will never be restored properly (or anything depending on actual password in time of backup), because of the removed password, you will need to set up it again after restore
- backup super, boot, dtbo and data partition (metadata partition is optional)

Restore:
- wipe cache, dalvik, data (optional)
- restore super, boot, dtbo and data partition (metadata partition is optional)
Reboot
(everything will be restored to the state in time of the backup) ¹)


- if needed remove Android password (OFOX recovery functionality) restored from backup either directly after restore or later from the menu with OFOX addons (the file PassReset.zip MUST EXIST in this location: /storage/emulated/0/Fox/FoxFiles/ for this to work !)
- in case you lost your OFOX addons thanks to format data or you are using TWRP 3.5.0_10-x, you can also directly delete all file(s) in /data/system which starts with locksettings* = remove password

Comment(s):
¹) your backups will be fully restored along with password/PIN/pattern and fingerprints - this will work until you'll format data (or for something else that needs to be discovered yet), after that you'll loose the ability to use your password to enter the system and depending on ROM features you can either skip password entering with fingerprints (RRemix) or reset your password so you can enter the system (CrDroid), in RRemix everything works, except you can't change your password etc, in CrDroid you need to re-setup your password depending apps

- if you remove your password Google Pay will never be restored properly (or anything depending on actual password in time of backup), you will need to set up it again after restore
x x x​
(encrypted vendor and storage used)
Backup:
- backup boot and data partition

Restore:
If you are restoring a data backup of an encrypted device, there are precautions that you should take before starting the restore process (obviously, your backup must be on MicroSD or other external storage medium - NOT on the internal storage):
  • Format the data partition (NOTE: format - not just wipe)
  • Reboot OrangeFox / TWRP
  • Flash the original zip of the ROM whose backup you are trying to restore
  • Wipe cache and dalvik
  • Reboot to system to ensure that the newly-flashed ROM actually boots, and that it re-encrypts the device with its own encryption
  • Reboot to OrangeFox / TWRP
  • Tap on the Backup icon
  • Select the partition(s) that you wish to restore
  • Swipe to restore

  • If you do not follow all these steps, you can expect problems with restoring data
Reboot

Comment(s):
TBA

Credits: OrangeFox devs as this guide (for encrypted vendor and storage used) is copied directly from OrangeFox wiki slightly modified by me by adding "/ TWRP" to the text

this guide will be updated if I discover new facts or post new, updated steps or how-to's
Hello

I tried to do a backup with this orfox version including 'super'. At the end it says:

Backing up Super...
Backup Failed, Cleaning Backup Folder

Do you have a idea what happened?

Edit: I guess it's because my phone is encrypted
 

temporarium

Senior Member
I guess this is as good a place as any to ask: what is the advantage of decrypting data?

I don't think running encrypted slows things down (not like it used to in the past when devices weren't as powerful), and there is the huge benefit of having your data secure. Any lost/stolen phone will soon send up in the hands of someone (on either side of the law) who knows adb/fastboot, so just having a password isn't going to protect your data if it's not encrypted.

It's possible to do backups of encrypted data, just the same as unencrypted.

Formatting vs wiping: ends up doing the same - all the data is gone and has to be restored. So that's a non-issue.

So, why should one prefer to decrypt?
 

XtraWater

Senior Member
Apr 8, 2018
618
106
Samsung Galaxy S5
Xiaomi Mi A1
I guess this is as good a place as any to ask: what is the advantage of decrypting data?

I don't think running encrypted slows things down (not like it used to in the past when devices weren't as powerful), and there is the huge benefit of having your data secure. Any lost/stolen phone will soon send up in the hands of someone (on either side of the law) who knows adb/fastboot, so just having a password isn't going to protect your data if it's not encrypted.

It's possible to do backups of encrypted data, just the same as unencrypted.

Formatting vs wiping: ends up doing the same - all the data is gone and has to be restored. So that's a non-issue.

So, why should one prefer to decrypt?

From my understanding the only benefit would be to update firmware without format data.

re backup super: There are about 70GB available on the SD card (destination of the backup). I tried to backup it again with the same result. Just looking at the log file but can't see what has failed. The line before Backup failed is:

I:Error writing destination fd(operation not permitted)
 

temporarium

Senior Member
From my understanding the only benefit would be to update firmware without format data.

re backup super: There are about 70GB available on the SD card (destination of the backup). I tried to backup it again with the same result. Just looking at the log file but can't see what has failed. The line before Backup failed is:

I:Error writing destination fd(operation not permitted)
Your card is probably formatted as fat32 which won't allow such big files.
 
  • Like
Reactions: pnin

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    Preliminary guide to BACKUP / RESTORE with
    OrangeFox recovery by ManoloRey

    LINK
    or
    TWRP recovery 3.5.X_10-x by brigudav

    LINK

    ! ! ! USE ONLY LINKED VERSIONS OF RECOVERIES ! ! !

    Consider this guide for (decrypted vendor (or encryption disabler) + decrypted storage used) as BETA, I don't recommend backup/restore procedures with OrangeFox recovery Beta or TWRP 3.5.0_10-x for actual backups of your data (TRY THIS ONLY AT YOUR OWN RISK) ONLY FOR TESTING / EDUCATIONAL PURPOSES !

    Do not ask for help if your data have been lost because they can't be restored, or suddenly your backup - successfully restored several times before - now can't be! This is still buggy and sometimes for unknown reasons restore of your data can fail ! Restore process always worked 100 % for me, but results sometimes differ !


    YOU HAVE BEEN WARNED!

    (decrypted vendor (or encryption disabler) + decrypted storage used)
    - backup boot and data partition

    Restore:
    - wipe cache, dalvik, data
    - flash ROM + GAPPS that you have installed when you created backup
    - restore backup of boot and data partition
    - remove Android password (OFOX recovery functionality) restored from backup either directly after restore or later from the menu with OFOX addons (the file PassReset.zip MUST EXIST in this location: /storage/emulated/0/Fox/FoxFiles/ for this to work !) but before reboot!
    - in case you lost your OFOX addons thanks to format data or you are using TWRP 3.5.0_10-x, you can also directly delete all file(s) in /data/system which starts with locksettings* = remove password
    Reboot

    Comment(s):

    - if you remove your password/PIN/pattern protection directly before backup you can end up after restore with system where you can't change your password/PIN/pattern anymore

    - if you forget to remove your password/PIN/pattern protection AFTER RESTORE you can end up after boot with system demanding to enter your password/PIN/pattern which MAY or MAY NOT BE ACCEPTED even if it is CORRECT and maybe INACCESSIBLE because of that

    - Google Pay will never be restored properly (or anything depending on actual password in time of backup), because of the removed password, you will need to set up it again after restore
    - backup super, boot, dtbo and data partition (metadata partition is optional)

    Restore:
    - wipe cache, dalvik, data (optional)
    - restore super, boot, dtbo and data partition (metadata partition is optional)
    Reboot
    (everything will be restored to the state in time of the backup) ¹)


    - if needed remove Android password (OFOX recovery functionality) restored from backup either directly after restore or later from the menu with OFOX addons (the file PassReset.zip MUST EXIST in this location: /storage/emulated/0/Fox/FoxFiles/ for this to work !)
    - in case you lost your OFOX addons thanks to format data or you are using TWRP 3.5.0_10-x, you can also directly delete all file(s) in /data/system which starts with locksettings* = remove password

    Comment(s):
    ¹) your backups will be fully restored along with password/PIN/pattern and fingerprints - this will work until you'll format data (or for something else that needs to be discovered yet), after that you'll loose the ability to use your password to enter the system and depending on ROM features you can either skip password entering with fingerprints (RRemix) or reset your password so you can enter the system (CrDroid), in RRemix everything works, except you can't change your password etc, in CrDroid you need to re-setup your password depending apps

    - if you remove your password Google Pay will never be restored properly (or anything depending on actual password in time of backup), you will need to set up it again after restore
    x x x​
    (encrypted vendor and storage used)
    Backup:
    - backup boot and data partition

    Restore:
    If you are restoring a data backup of an encrypted device, there are precautions that you should take before starting the restore process (obviously, your backup must be on MicroSD or other external storage medium - NOT on the internal storage):
    • Format the data partition (NOTE: format - not just wipe)
    • Reboot OrangeFox / TWRP
    • Flash the original zip of the ROM whose backup you are trying to restore
    • Wipe cache and dalvik
    • Reboot to system to ensure that the newly-flashed ROM actually boots, and that it re-encrypts the device with its own encryption
    • Reboot to OrangeFox / TWRP
    • Tap on the Backup icon
    • Select the partition(s) that you wish to restore
    • Swipe to restore

    • If you do not follow all these steps, you can expect problems with restoring data
    Reboot

    Comment(s):
    TBA

    Credits: OrangeFox devs as this guide (for encrypted vendor and storage used) is copied directly from OrangeFox wiki slightly modified by me by adding "/ TWRP" to the text

    this guide will be updated if I discover new facts or post new, updated steps or how-to's
    4
    Thanks for your patience. I was under the impression that if you disable security locks then you had no encryption and the script would just ensure it would remain so. By your reaction I'm assuming I was wrong...

    Overall, I am just getting fed up with always having to format data and having to start from scratch.

    I not longer have OFox, I'm currently running brigudav's TWRP "v3.5.0_10-5-surya".
    As you said, that encryption_disabler.zip is a shell script, which makes the folder in /product/vendor_overlay/29/etc and copies fstab.qcom from vendor to it. Then edits every line using the shell command sed (aka stream editor) that includes the string fileencryption= with the string encryptable=.

    The above described process is usually done on the first boot of a newly installed ROM as is with every vendor_overlay entry in product (minus the edited strings ofc). Editing it after the ROM reads vendor fstab.qcom and encrypts the data partition is useless. However, formatting data (deleting keystore essentially) and flashing that .zip should also do the trick. Might as well update your base MIUI and ROM while you're at it :p
    3
    @jeryll , any thoughts? I think you're a proponent of running decrypted. Why? What are the pros/cons in your opinion?
    I personally just don't like if something is forced on me (at all), which POCO/XIAOMI does with that default enabled encryption ... why? Lets leave it off and if somebody want that, it can be turn on, no? What precious data do you have on your phone, that it needs be encrypted all the time? How often do you loose your phone to prove that encryption is useful to be default on? And seriously do you trust POCO/XIAOMI that they protect your data with "this" encryption?

    If I wanted a secure phone the only option is Samsung (with Knox at least) - IT guys in my work only allows Samsung phones - if you want to use your phone in company network... - or some specialized phones available on the market, but surely not POCO/XIAOMI ...

    Encryption turned on by default is not a problem, if you're a MIUI user, who update MIUI 10-20 times in the phone life cycle? For MIUI you only format data maybe once if you're upgrading also Android version ...

    But for a custom ROM user, who likes to test new ROMs available and most of the time also likes to go back, because most of the new ROMs sucks anyway :(

    Not to mention that if you have a lot of photos, music, medias on your internal storage - god forbid that you forget to backup those in cloud or copy to external sdcard... before you format data...

    And what about backup restore? I want perfect nandroid backup as I was used to do on A9, and I want to restore it also perfect - you can forget about this with encrypted storage...

    Personally I don't give a sh*t if my internal storage is encrypted or not - give me the tools for a backup and restore and ROM installation without format data and I'm a happy camper...
    2
    @temporarium, it has already been confirmed that there is no way around a clean flash with A11+OSS vendor, so trying to dirty flash the A11+OSS upgrade is out of question.

    Not sure on how to proceed. Starting from scratch with at least user app + app data backup using OAndBackupX is an option, but that's going to be extremely cumbersome for six phones.

    And then there is the issue that according to @evolez in his reply concerning the ArrowOS 11 update, there is no custom recovery supporting A11+OSS device decryption yet, so if this is true, I will have to wait for an update to OrangeFox or TWRP anyway, because there is no way I'm going to forego device encryption.
    - unless OOS vendor has fixed NFC bug (Gpay payments not working) I would avoid to install any ROM using it if you need that functionality ... If you must - use Swift backup (or Migrate) to backup your apps + data, do a clean flash of ArrowOS(OSS) - or with something that you are familiar with ... and restore ...
    - you can try on one of your phones to backup /data partition, do a clean flash of ArrowOS(OSS) and restore /data after - maybe it'll work, that need to be tested anyway by someone ...
    - if possible use latest brigudavs TWRP to do backup and restore (it "should" work with A11 encryption - not tested) - not sure when will be Ofox for surya updated to work properly with A11 encryption, but that depends entirely on Ofox devs, they may wait when A11 TWRP branch/source will be marked as stable and that may take time (1 - 6 months)
    - in a few hours (waiting for unlock (last hour - YAY!)) I am switching to my new phone (sweet - Redmi Note 10 Pro) where only latest TWRP is able properly decrypt A11 encryption, and devs compiling Ofox for "sweet" says they cant do nothing about it unless ofox devs update sources from TWRP and that may take time (1 - 6 months)
    2
    So, are you jumping PX3 ship? At least the forums here will be a lot poorer when you do... 😟
    - yep, but "sweet" is basically PX3 with amoled display and slightly better camera (also it has working MIUI 12 where all my Android apps actually works - shame on you POCO SW engineers!) and way better signal reception ... I can only recommend it ...
    - I'm giving my PX3 to someone who may or may not accept it, so if it will stick with me, I will use it for far more testing as until now ... we will see ...