[Redmi Note 8 Guides, News, & Discussion] CommieColin:
Hey all,

After accidentally wiping the persist partition on my Redmi Note 8, I struggled to find a simple way to restore it after realizing none of my sensors were working properly, despite trying out multiple custom ROMs and the official Fastboot ROM. Turns out, even Xioami's flash tool doesn't touch/write to /persist without some modification, making it more or less useless in fixing this type of issue.

Here's a quick and relatively easy guide which will help you repair/restore a corrupted or deleted /persist partition on your Xiaomi phone:

For those who don't know, the persist partition on your Xiaomi phone contains/stores most if not all data required for your phone's sensors to work properly. This includes the light, proximity, accelerometer, gyroscope, compass, barometer, etc.

If you find that any of the sensors listed above are acting strange or not working at all, there's a good chance your persist partition has been corrupted. The wonderful Wiki on the Xiaomi subreddit contains some very useful information on how to go about fixing these issues, but it requires some editing to the Xiaomi Flash Tool, along with putting your phone in EDL mode. This can be a lot for new users or folks who don't have access to a Windows machine. Additionally, there are many how-tos on XDA/the Xiaomi forums which require running ADB commands or using a terminal emulator - also a lot of work for something which can be solved with a custom recovery.

This guide seeks to simplify the process outlined in the Wiki guide.

Requirements:

Unlocked bootloader

ADB/Fastboot

Orange Fox Recovery Project

Fastboot ROM for Redmi Note 8

7-Zip (for extracting the Fastboot ROM)

Some basic knowledge of ADB/Fastboot

A little bit of gumption

Steps:

1. Download and install ADB/Fastboot using the link provided - this will place a folder called "adb" at the root of your C: drive (or whatever main drive letter you use)

2. Download the Fastboot ROM for the Redmi Note 8

3. Use 7-Zip to extract the ROM - you might have to extract the folder a couple times to get to the persist.img file

4. In the extracted Fastboot ROM folder, navigate to the "images" folder and locate persist.img

5. Download the OrangeFox Recovery zip and extract it (don't delete the zip yet; you'll need it momentarily) - rename the image file to "recovery.img"and place it in the adb folder at the root of your C: drive

6. Reboot your phone into Fastboot mode - this can be done by powering off your phone and then holding the power and Vol. Down buttons at the same time - alternatively, you can use the command "adb reboot bootloader" if you are familiar/comfortable with ADB

7. Flash OrangeFox Recovery to your unlocked phone using fastboot - the command is: "fastboot flash recovery recovery.img" - you will see Fastboot confirm the recovery.img has successfully been sent to your phone

8. Type "fastboot reboot" and hold the volume up button on your phone - press enter and continue to hold the volume up button - your phone will reboot into OrangeFox Recovery

9. Decrypt your data or format data to enable MTP File Transfer

10. Copy the OrangeFox zip and persist.img to the root of your phone's memory

11. Navigate to the OrangeFox zip and flash it - your phone will reboot back into recovery (the zip is required to finalize the OrangeFox install on your phone)

12. Navigate to your phone's root storage and select the persist.img file you copied

13. OrangeFox will ask you which partition you want to write persist.img to - select the Persist partition and swipe to flash

14. Wait for the confirmation message and flash your custom ROM or whatever else you need - you're also free to use the Xiaomi Flash Tool to restore the rest of your phone to stock (be sure not to re-lock your bootloader when doing so! Select clean_all.bat in the lower righthand corner)

15. Profit!