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

An Easy Guide to Restoring/Repairing Your Persist Partition on Unlocked Xiaomi Phones

Search This thread

CommieColin

Senior Member
Nov 28, 2014
188
51
Albany, NY
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!
 
Last edited:

CommieColin

Senior Member
Nov 28, 2014
188
51
Albany, NY
For this phone the persist partition is locked when using fastboot - if you attempt to flash it that way, it will tell you it is a restricted partition and the flash will fail. This was the next easiest method I had found
 

wsdyleon

Senior Member
Feb 2, 2012
631
50
POCO M3 Pro / Redmi Note 10 5G
For this phone the persist partition is locked when using fastboot - if you attempt to flash it that way, it will tell you it is a restricted partition and the flash will fail. This was the next easiest method I had found
thank you 。but i can flash it normally,without failed tips。
========================================================================
with this method ,i get back to normal,thanks again!!!
 
Last edited:

CommieColin

Senior Member
Nov 28, 2014
188
51
Albany, NY
thank you 。but i can flash it normally,without failed tips。
========================================================================
with this method ,i get back to normal,thanks again!!!
You're saying you can use fastboot flash persist persist.img without error? That is news to me, but I'm glad it worked out for you!
 

cookiecooker

Member
Mar 18, 2021
7
5
I followed the instructions, you linked me to this post of yours from here:
Unfortunately it didn't fix the issue for me.

The only thing I have done differently just now was that I didn't follow step 14. I didn't flash my custom ROM again.
Is that needed to finally fix the issue?
 

CommieColin

Senior Member
Nov 28, 2014
188
51
Albany, NY
I followed the instructions, you linked me to this post of yours from here:
Unfortunately it didn't fix the issue for me.

The only thing I have done differently just now was that I didn't follow step 14. I didn't flash my custom ROM again.
Is that needed to finally fix the issue?
I'm sorry to hear that - it's worked perfectly for me in the past. To be safe, I would use the MiFlash Tool from Xiaomi's website to restore a stock ROM (this won't fix your persist partition as the flash tool does not write to it by default) - then reflash OrangeFox, reflash your persist.img and either test it out on MIUI or try a custom ROM
 
Have some issue recently with my Note 8T... screen remain black upon receiving a phone call!!! I just got the ringtone! Sensors seems fine as long as the screen goes off when I initiate a call and close the device to my ear... I already flash that partition but still get the same strange behavior... did not had this issue before. I already had this MIUI version but because a lot of bug I encountered on ANdroid 11 update I chose to go back to previous MIUI version, 12.0.4.0... and the issues started! Did not even had signal on my both sims... then I found out about persist partition, did the flashing, got signal back but now I get this black screen when I have an incoming call!!!

The screen just does not light up when I have calls!!!
All notifications are setup properly, DND is off... proximity sensor works when I initiate calls...
What is going on here???

L.E.

REAL ISSUE IS THE SEPTEMBER UPDATE FROM PHONE APP OF GOOGLE!!!
TESTED MANY TIMES.
I update the app, screen remains black during an incoming call, uninstall the update, phone app works normally! Even tried latest beta from PlayStore... issue is still there, it is not fixed...
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    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!