[Redmi Note 10] pipoawas:
After a disastrous experience trying to root my phone through Magisk and their "modified" boot.img, I lost everything on my phone. Worse even, TWRP was unable to restore my system from my TWRP nandroid backup.

But after days of investigating solutions, trying tirelessly, I finally, FINALLY was able to restore my nandroid into my phone.

It should have been straight forward, that's the purpose of a nandroid, right? But it wasn't, because my TWRP backup (nandroid) was some updates behind my current phone OS, and apparently that was enough, because phone brands and google can't stop messing with low level android "for our safety and privacy" (google taking care of our privacy, LOL!), and as such they keep changing stuff about partitions, boots, protections, all this new crap about A/B slots, 'vendor' and 'vbmeta' .img files, and whatnot. There's even a file called 'uefi_sec.mbn' in the ROMs now.

When I was trying to restore from my nandroid backup, half of my partitions were giving me errors at restoring, and /data was giving me the infamous "createTarFork() process ended with ERROR=255". Rebooting only gave me either bootloops, or a reboot only to the bootloader.

Something in the partitions had irreversibly changed with the new updates, and not even a previous nandroid was able to deal with it and put it all back as it was before. All my stuff *right there* in that backup, ready to surface again in a supposedly seamless process, and I was unable to reach it. So close and yet so far away. It was infuriating.

So I decided to trace back everything. What I tried *and worked* after many attempts, was this:

(

NOTE:

this will recover virtually everything you had in your system when you made the nandroid, but it could wipe your internal storage, depending on your ahead decisions)

— Make sure you have ADB and Fastboot tools installed on your desktop computer, and also the same ROM you had when you made the nandroid or another one close enough (more details ahead), and the same TWRP version from which you created the nandroid.​

​

— Have an SD card and copy your nandroid backup there (the whole "TWRP" folder in your storage root), if it isn't there already.​

​

— Get a ROM closer in version/date to the one you had when you created the nandroid backup. If it's the same even better, no matter if it's outdated, you want it outdated, since it matches your also outdated nandroid. E.g, if your phone was on MIUI 13 and you made your nandroid when you had MIUI 12.0.2, then get the 12.0.2 ROM or another close enough. Also match the other ROM specifications you have in your nandroid backup (Global/India(Indonesia/China/Russia). And get the FASTBOOT ROM version instead of the recovery version, and save it to your desktop computer.​

​

— Now decompress the gzip file of that ROM: you'll get a .tar file, decompress this one either, until you get a folder with files inside and a 'images' folder. Winrar or 7Zip will decompress those easily. To avoid long pathnames, put this folder in the root of your hard drive.​

​

— Boot your phone into bootloader/fastboot, connect it to your PC/MAC, and install that ROM via fastboot, with the script files included in the rom folder flash_all.bat (flash_all.sh for linux or Mac). Mind you this script will also wipe your internal storage, so make sure you have previously backed your stuff from there (search the internet on how to pull/save files from internal storage through adb pull, or even easier, put a SD card and save your stuff to it, assuming your internal storage isn't reading 0bytes as mine was...)​

NOTE: If you really want to preserve your internal storage you can instead run the script flash_all_except_data_storage.bat/(.sh), but I don't know if it will be as effective.​

​

— Once the rom is flashed through fastboot, reboot the phone and config the device with the initial settings screen (I don't know if this step is really necessary, but it worked with me), until you can see app icons on the home screen.​

​

— Now reboot the phone into bootloader mode (fastboot), connect it to the PC, and boot TWRP WITHOUT flashing, you'll just boot it by running TWRP into the ram disk of the phone. The recovery of the now installed ROM

needs to be untouched, or you'll have bootloops

. To boot TWRP without flashing it, you enter this on the command line: fastboot boot twrp.img (considering twrp.img is the name of your TWRP file, and it's present in your current path)​

NOTE: It may be important to work with a

twrp version similar in version to the one you used when creating the nandroid backup

, you never know...​

​

— Now with TWRP running from the phone's RAM, use your PIN to unencrypt the phone storage if it is asked.​

​

— Using the Mount button, mount every partition you see except OTG_USB. I don't know if this step is necesssary, but it worked with me.​

— Do a normal wipe to the phone (no need to go to the advanced wipe). Again, I don't know if it's necessary, but it doesn't hurt. But it's

almost certain this will wipe your internal storage

, so you decide

.​

​

— Now finally go to the restore button of TWRP, select your external SDcard as the storage where your backup is, select the backup from the folder browser, and choose to restore ALL the partitions from your nandroid backup (when I created my nandroid backup, I backuped every partition except maybe dalvik cache)​

Now you wait, drink a glass of wine, go outside, it may take a while restoring everything, specially if you created your nandroid with compression enabled. Hopefully this won't give any errors, or at least no significant ones. Once it's done, reboot, wait a little longer since it may take longer to reboot this one time. When that is also done, hopefully you have your phone the way you had it when you created the nandroid backup, with your system, preferences, apps AND all their data, home app folders, chats, SMS messages, etc.

You may find some small stuff slightly off, like having the day theme while you're sure your phone always had the night theme, the clock now has a different setting, no fingertprints installed, maybe this is stuff inherited from the rom you flashed that remained, but all of this is easily configurable to what you want.

And that's it!

Now, after all this, you want to go to your appstore app and update all your apps -- they are the very same apps stored in the nandroid, they may be outdated, my nandroid was 6 months old -- and also update your OS through OTA or other means, since your rom is also outdated.

Optionally, after all this is done, you may want to make another nandroid backup: reboot into bootloader, connect the phone to the PC, again reboot to TWRP without installing it since it's better if your original recovery remains untouch (do fastboot boot twrp.img ), -- this time you can use an updated TWRP version -- select the storage you want to save the nandroid backup to (either internal storage or the SD card), and select all your phone partitions for backup except internal storage, SD card, and cache. Reboot your phone to system, and save your new nandroid somewhere safe in your PC's hard drive. If you encrypted your nandroid with a password, save that too, otherwise if a time of need arrives, you'll have nothing.

And very important, DON'T TRY TO ROOT IT with Magisk with that altered boot.img process they have, which supposedly "doesn't touch your partitions". You'll only get tears with that, since not even trying to flash your original boot.img will get your system back. Maybe they'll correct this in the near future, but for now avoid it like the plague. They also have an older way of installing root through TWRP and a zip file, I don't know if this one still works. But AVOID the other one.

This process helped me immensely, I hope it also helps someone with the same problem I had.