[Xiaomi Redmi Note 7 ROMs, Kernels, Recoveries, & O] DarthJabba9:
Creating and Restoring backups

Backing up and restoring can be very problematic if not done properly. Since you will be relying on the backups, this needs to be done with great care. So, I am devoting a separate post to this topic.

Here, I will explain

what works for me

(your mileage may vary). But, first of all,

read this

: https://twrp.me/faq/whattobackup.html (and

note especially

the recommendations concerning "system" versus "system_image", and "vendor" versus "vendor_image").

1. In my opinion, only your data partition (and perhaps the internal storage) should be backed up via a Recovery. While this may seem a bit unusual, you really should

always

keep a copy of your full ROM's zip installer.

By keeping a copy of your ROM's zip installer, restoring the ROM would be a simple matter of formatting data, clean-flashing the ROM, booting up the newly flashed ROM (to make sure that it actually boots, and to let it encrypt the storage in its own way), and then rebooting to recovery mode. This would give you a working device, and a fresh copy of the boot, system, and vendor partitions. Then you only need restore the backed up data (and internal storage), and you have your system again.

2. For full backups in recovery mode (if you must), the

safest option

would normally consist of:

Boot

Data

System_Image

Vendor_image

Internal storage

3. Do not rely

entirely

on a nandroid (ie, Recovery) backup of your internal storage (ie, your user data, photos, etc). It is wise to have copies in the cloud, and/or on your PC.

4. Do not rely

entirely

on a nandroid (ie, Recovery) backup of your data partition. It is wise to let your ROM backup your settings and apps data to the cloud (eg, google drive), or use an app to do the same. This provides a second line of defence. The reason for this advice is the dreaded "extractTarFork() error 255" which can sometimes (and randomly) occur when backing up, or (more devastatingly) when restoring a /data partition backup. Nandroid backups of the /data partition are potentially unreliable, and that is just the way it is. You might also want to read this.

5.

Always

take a backup of your user data (to an external storage device or the cloud)

every time

you want to flash

something

(anything - ROM, recovery, mods, OTA updates, or whatever else). Particularly, with a device like lavender (with very flaky encryption), flashing or updating

anything

at all can potentially lead to your needing to

format your data partition

to get rid of

broken encryption

(this is especially the case with regard to moving from

any

ROM to

any other

ROM). Ignore this advice at your own peril.

6. Creating backups of encrypted data is fraught with risks. If you want to backup the data partition of an encrypted device, you would be very well advised to first delete the lockscreen password/pin in the ROM

before

booting to recovery to create the backup. If you don't do this, you

must

accept the invitation to delete the ROM password (also available in the OrangeFox add ons menu) immediately after restoring the backup. Note - with

lavender

, if you have any of those new Android 10 custom ROMs that use FBE, you will have to work out for yourself what works for you ...

7. Do

not

try to restore a backed-up data partition from one ROM to another ROM.

8. Do

not

try to restore a backup of an encrypted device to a device that is not encrypted, or to a device that is encrypted with a different encryption protocol.

9. Watch this space for more stuff to be added in the future.