[Guide] About repairing/fixing the persist partition

Search This thread

Shubham R. Dukhande

New member
Jun 22, 2021
4
2
Disclaimer: I am not responsible for the results of any of these operations.


Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

This was how it happeded:
While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

adb shell

cd /dev/block/by-name

ls -all

Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
I have also posted them to Mi Community.
Flash the repair tool in attachment. Choose the right file and flash it.
Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


If you think it's useful, please click the "Like" button.

my experience for you:i succedd in flashing the persist.img into my note8,but sensor still worked abnormally,at last i flash persist.img from the oldest ver fastboot rom when i bought ,it worked
Hi @wsdyleon , thanks for replying. Correct me if I am wrong. I think out of the box my device was on MIUI 10, Android Pie (9), I am not sure though. Now I am on MiUI 12, Android Q (10) [refer attached screenshot]. So I will have to flash the persist.img from MIUI 10, Android Pie (9) fastboot rom? Also, do I have to directly flash only persist.img or replace it with the img in Yuki's tool zip and flash Yuki's tool zip. If yes, I will have to use repair_persist-ginkgo(mi).zip this zip, right, since I am not on China rom?
 

Attachments

  • Screenshot_2021-06-28-10-40-47-799_com.android.settings.jpg
    Screenshot_2021-06-28-10-40-47-799_com.android.settings.jpg
    230.3 KB · Views: 29
Last edited:
i think you can flash back to normal stock rom
ya, I flashed stock rom but now my phone restarts in a minute of turning on. please look at this once and help
 

wsdyleon

Senior Member
Feb 2, 2012
655
52
POCO M3 Pro / Redmi Note 10 5G
Hi @wsdyleon , thanks for replying. Correct me if I am wrong. I think out of the box my device was on MIUI 10, Android Pie (9), I am not sure though. Now I am on MiUI 12, Android Q (10) [refer attached screenshot]. So I will have to flash the persist.img from MIUI 10, Android Pie (9) fastboot rom? Also, do I have to directly flash only persist.img or replace it with the img in Yuki's tool zip and flash Yuki's tool zip. If yes, I will have to use repair_persist-ginkgo(mi).zip this zip, right, since I am not on China rom?
someone give method to flash “persist.bak” if you donnot delete 。or you should download the old ver fastboot rom ,and take out the persist.img,the persist.img must be in accordance with your model
 

wsdyleon

Senior Member
Feb 2, 2012
655
52
POCO M3 Pro / Redmi Note 10 5G
ya, I flashed stock rom but now my phone restarts in a minute of turning on. please look at this once and help
i suggest you unlock your phone infastboot mode,and then flash the persist also in fastboot mode(using adb platform-tools )
 

Yuki1001

Senior Member
i suggest you unlock your phone infastboot mode,and then flash the persist also in fastboot mode(using adb platform-tools )
Flashing persist and persistbak in fastboot mode is impossible. So I made these flashable zips for Redmi Note 8 users after I managed to fix the persist and persistbak. Right now with no auth programmer for Sm6125 we can also flash these 2 partitions in EDL mode.
and then flash the persist also in fastboot mode(using adb platform-tools )
If you tried this method and success, please tell us the firmware version you are using and give screenshots of successful flashing.
Normally the bootloader will reject flashing persist and persistbak partition. These limitations are in place since years ago!

Here's my Redmi Note 8 (ginkgo). Flashing both persist and persistbak in fastboot is not allowed by Xiaomi.
sc11.png


But it allows erasing both persist and persistbak. Weird.
 
Last edited:

wsdyleon

Senior Member
Feb 2, 2012
655
52
POCO M3 Pro / Redmi Note 10 5G
Flashing persist and persistbak in fastboot mode is impossible. So I made these flashable zips for Redmi Note 8 users after I managed to fix the persist and persistbak. Right now with no auth programmer for Sm6125 we can also flash these 2 partitions in EDL mode.

If you tried this method and success, please tell us the firmware version you are using and give screenshots. Thank you.
Normally the bootloader will reject flashing persist and persistbak partition.

Here's my Redmi Note 8 (ginkgo). Flashing both persist and persistbak in fastboot is not allowed by Xiaomi.
View attachment 5352023

But it allows erasing both persist and persistbak. Weird.
did you try “”fastboot --disable-verity flash persist persist.img
using adb platform-tools at unlocked
 

Yuki1001

Senior Member
did you try “”fastboot --disable-verity flash persist persist.img
using adb platform-tools at unlocked
Also not allowed flashing these 2 partitions even with --disable-verification --disable-verity. These arguments are used for flashing vbmeta.
Please give your screenshot of successful flashing and the firmware version of your device.

Flashing persist and persistbak are NOT allowed in fastboot mode. These limitations are in place since years ago.

Right now with my knowledge, flashing persist and persistbak could be done with 3rd party recovery like TWRP etc. and EDL mode. Since we've got no auth programmer for Sm6125 we could flash anything in EDL freely.

But the most convenient flashing method is flashing my zip with a simple swipe, isn't it?
 
Last edited:

hehehehe1123

New member
Jun 11, 2021
4
0
Disclaimer: I am not responsible for the results of any of these operations.


Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

This was how it happeded:
While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

adb shell

cd /dev/block/by-name

ls -all

Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
I have also posted them to Mi Community.
Flash the repair tool in attachment. Choose the right file and flash it.
Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


If you think it's useful, please click the "Like" button.
thank you. but not working. can you make a flashable zip file for redmi note 5 pro.
 
Last edited:

dfrios

New member
Jul 4, 2012
1
0
Medellin
blog.davidrios.me
Disclaimer: I am not responsible for the results of any of these operations.


Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

This was how it happeded:
While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

adb shell

cd /dev/block/by-name

ls -all

Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
I have also posted them to Mi Community.
Flash the repair tool in attachment. Choose the right file and flash it.
Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


If you think it's useful, please click the "Like" button.
You are the fu***ing admin! I was looking for this since I accidentally wiped "persist" partition on my Redmi Note 8. You saved my day. THANKS from the bottom of my heart.

I just downloaded the file you attached, moved to my cellphone using ADB (I was on TWRP):

adb push repair_persist-ginkgo(mi).zip /sdcard1/

Then I pressed INSTALL button on TWRP, selected that file, swiped to install it, and voila! The magic was done.
 

Oddking

Member
Jun 25, 2020
8
0
Disclaimer: I am not responsible for the results of any of these operations.


Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

This was how it happeded:
While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

adb shell

cd /dev/block/by-name

ls -all

Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
I have also posted them to Mi Community.
Flash the repair tool in attachment. Choose the right file and flash it.
Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


If you think it's useful, please click the "Like" button.
Omg thank you so much you just saved my phone the 2nd method worked like a charm
 
ive been wondering did you manage to fix your persist partition on poco f2 pro?
Yes. I go to CIT test and in advanced settings lef or right corner, i follow all test. Even with fingerprint,I remember I need something white and sime black. After doing all this couple test. Fix my fingerprint sensor.and alll others
 

joekerr00

Member
Mar 8, 2016
45
3
I've been having camera issues with my Poco citrus device for the past year I even reflashed the device twice and was thinking of buying a new camera when I stumbled across this thread, my question is isn't IMEI and MAC stored in persist how can the same image be used across devices (same model obviously) should I try with overwriting persist persistback or use a persist image from mi, there are quite a few images out now do I flash the oldest or current Miui 12.5 ROM image?
 

Yuki1001

Senior Member
I've been having camera issues with my Poco citrus device for the past year I even reflashed the device twice and was thinking of buying a new camera when I stumbled across this thread, my question is isn't IMEI and MAC stored in persist how can the same image be used across devices (same model obviously) should I try with overwriting persist persistback or use a persist image from mi, there are quite a few images out now do I flash the oldest or current Miui 12.5 ROM image?
1. IMEI and MAC addr are not stored in persist/persistbak. They are stored in safer places where you never need to touch.
2. Persist and persistbak images could be flashed at any time when needed.
3. You must use your own persist.img which made for your device to write to 2 partitions.
 
  • Like
Reactions: Uluru25

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi Yuki1001

    Great guide / fix!

    Could you please do us (all those concerned with restoring Widevine DRM L1 security / TEE for HD video streaming after persist corruption) a favour if you still have this device? (I have RN8T.)

    Please can you install and open DRMInfo app, and just say if Security level is L1 under Widevine CDM?

    Many thanks, PW 👍
    Hello pndwal:

    I still have RN8 (as one of my backup phones) because it has the ability to try out anything without interrupting my work. Flashing persist is necessary when your persist partition corrupts which may cause sensors fail. Your DRM level changes to L3 at the time you unlock the bootloader.

    BR.
    1
    Hello pndwal:

    I still have RN8 (as one of my backup phones) because it has the ability to try out anything without interrupting my work. Flashing persist is necessary when your persist partition corrupts which may cause sensors fail. Your DRM level changes to L3 at the time you unlock the bootloader.

    BR.
    But it seems most MIUI devices don't actually lose Widevine L1 security (for decoding HD in TEE) with bootloader unlock; only if persist is corrupted... That's why I wondered if your fix, particularly 1) Restore from persist.bak, restores L1...

    I have Redmi Note 8T, stock, rooted... Always had L1:
    IMG_20220428_212126.jpg

    🙂 PW
    1
    What method you mean ? persistbak or the zip ?
    The persistbak.... I have messed up the persist.img backup file. Didn't knew there was a backup partition.
    1
    But it seems most MIUI devices don't actually lose Widevine L1 security (for decoding HD in TEE) with bootloader unlock; only if persist is corrupted... That's why I wondered if your fix, particularly 1) Restore from persist.bak, restores L1...

    I have Redmi Note 8T, stock, rooted... Always had L1:
    View attachment 5600539
    🙂 PW
    My RN8 is obviously L3.

    At that time I had only thought my phone was damaged, with strong nervous I found the persistbak and did a dd command to restore the persist. Then I'd like to help everyone who did something same with me to get out of such situation with an easy solution. Then I made these flashable zip files and uploaded to the thread.

    I've lost my original persist/persistbak backup and have overwritten the 2 partitions for many times so my phone will last L3 forever. But if you didn't touched persistbak, do a backup of its raw data to a safe place in order to restore your own unique image, instead of a generic persist.img.


    The generic persist.img is only for emergency situation, but it's surely a way to fix, isn't it?


    Actually I seldom touch DRM content. I buy DVDs and CDs for watching films and listening to music.
  • 24
    Disclaimer: I am not responsible for the results of any of these operations.


    Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

    This was how it happeded:
    While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

    As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


    1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
    Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

    adb shell

    cd /dev/block/by-name

    ls -all

    Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

    dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

    Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

    Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
    I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
    I have also posted them to Mi Community.
    Flash the repair tool in attachment. Choose the right file and flash it.
    Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    If you think it's useful, please click the "Like" button.
    2
    Does this fix "device storage corrupted" error?
    Actually I have this error but my sensors, carrier, wifi ... Etc all working great this error still appears. Anyway I think magisk hide config props module damaged my device's persist when I changed the fingerprint then I came back to stock rom and this error happened so my question is: is this process risky Or could cause losing mac or imei? And am I going to lose widevine l1?
    I'm thinking about backing up my current persist before proceeding do you think it's a good idea?

    Yes. It can fix "find device storage corrupted" . You won't lose your imei or mac. At that time I erased the persist partition by a command "fastboot erase persist" accidently. I have tried both method 1 and 2, and the error is no longer appeared.
    About backing up, the persistbak partition is a backup partition for your current persist partition. So if you failed, just restore the persistbak to the main persist partition. And you can also export the raw image of your current persist partition. Of course, the error will appear if you restore the corrupted persistbak.
    1
    Disclaimer: I am not responsible for the results of any of these operations.


    Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

    This was how it happeded:
    While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

    As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


    1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
    Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

    adb shell

    cd /dev/block/by-name

    ls -all

    Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

    dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

    Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

    Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
    I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
    I have also posted them to Mi Community.
    Flash the repair tool in attachment. Choose the right file and flash it.
    Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    If you think it's useful, please click thanks button.
    not to hate or dislike or be rude or anything... but people will lose Widevine L1 support by this method... so if anyone doesn't want HD videos on netflix etc, go ahead with this method.. otherwise don't even touch persist partition.
    1
    Hi Yuki,

    Greetings from India, hope you and your family are doing well.

    I own a Redmi K20 (davinci). I had installed Pixel Experience rom, which I didn't like and wanted to roll back to stock rom. But without reading the guide to flash fastboot rom, I flashed the back up I had taken via TWRP. Apparently, my phone was bricked and I had to enter edl mode via cmd and flash the stock rom which showed some error, but the phone booted to stock rom. Everything is working fine, even the touch-fingerprint sensor is working. All the other sensors aren't. I tried a lot of things, but to no avail. I took my device to the official service centre, they couldn't fix the sensors' issue.

    A couple of days ago, I stumbled upon your post on Redmi 8-sensors-not-issue solution. Can I use the same tool to fix the persist partition on my phone? I had read one of your replies saying: specific phone's persist.img should be extracted from the fastboot rom and replaced with one in your tool.

    It would be a great help if you could guide me.

    Many thanks
    my experience for you:i succedd in flashing the persist.img into my note8,but sensor still worked abnormally,at last i flash persist.img from the oldest ver fastboot rom when i bought ,it worked
    1
    I've been having camera issues with my Poco citrus device for the past year I even reflashed the device twice and was thinking of buying a new camera when I stumbled across this thread, my question is isn't IMEI and MAC stored in persist how can the same image be used across devices (same model obviously) should I try with overwriting persist persistback or use a persist image from mi, there are quite a few images out now do I flash the oldest or current Miui 12.5 ROM image?
    1. IMEI and MAC addr are not stored in persist/persistbak. They are stored in safer places where you never need to touch.
    2. Persist and persistbak images could be flashed at any time when needed.
    3. You must use your own persist.img which made for your device to write to 2 partitions.