[Guide] About repairing/fixing the persist partition

Search This thread

Yuki1001

Senior Member
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.
 

Attachments

  • repair_persist-ginkgo(mi).zip
    887.4 KB · Views: 1,982
  • repair_persist-ginkgo(cn).zip
    887.4 KB · Views: 783
Last edited:

[email protected]

New member
May 9, 2020
1
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. Here is a way to fix the persist partition.


This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition.
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.
Find someway to download the fastboot ROM for your device. Exract the tgz file and open the folder called "images". Copy the "persist.img" to the adb tool folder. Because of the limitations of Xiaomi, you can't flash the persist partition or the persistbak partition directly. Copy the persist img file to the internal storage or sdcard on your phone. Now reboot to twrp recovery, connect the phone to your PC. Use these command to make a file that you can dd it to the persist partition and the persistbak partition:

adb shell

simg2img /sdcard/persist.img /sdcard/persist333.img

Now you have a file that can dd to the persist/persistbak partition. Then type these following commands in order:

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 and the persistbak partition immediately. Type these following commands in order:

dd if=/sdcard/persist333.img of=/dev/block/mmcblk0p$$

dd if=/sdcard/persist333.img of=/dev/block/mmcblk0p%%

Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partitions block name.
Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check the whether sensors and carrier network etc. all work fine.


If you think it's useful, please click thanks button.

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?
 

Yuki1001

Senior Member
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.
 

Yuki1001

Senior Member
Update: I have uploaded 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.
 
Last edited:

Yuki1001

Senior Member
Good work.

Just one query. In your original post, you mention simg2img command. I'm wondering if that is actually needed or wanted, given that the fastboot ROMs contain persist images that are not sparse.


Yes. You are right. I have been flashed my redmi note 5's persist partition and its a sparse img file. Look like this img file is a raw img not sparse file. Thanks for the tip. I have changed the content of method 2. And it's really easy to flash both persist and persistbak using my repair tool.
 
Last edited:

Yuki1001

Senior Member
Last edited:

Yuki1001

Senior Member
Are you serious?

Of course I tested it. In fact I tested it extensively, and the script has error checking for every single action command

The persist image, as I explained in my post is from the Global Note 8T 11.0.4.0 ROM. It will only probably work on the Note 8T.

It would of course work on just about any similar phone, if you replace the persist image with your own.

OK. Thanks for the reply I will test your zip file tomorrow. It should be a good work. Just technical discussion, nothing else.
 

Yuki1001

Senior Member
Your original method 2 used 'dd'. Are you saying 'dd' is wrong?
Are you saying that in addition to the incorrect use of simg2img, your entire method was faulty?

And just what exactly is the difference between 'dd' and 'package_extract_file'?

These are not questions that require an answer, because one of us already knows the answers, and checks their 'advice' before posting.

I don't think dd is wrong if the img is a raw image. It should can be dd to the partition. I'm sorry if I said something wrong and don't be angry please. Just discussion, nothing else. I will test your file with my persist.img tomorrow.
 

Yuki1001

Senior Member
Hi! Thanks for the input! Would I lose L1 widevine DRM validation with this method?

Is your persist partition broken? If so just flash it. Don't think too much. The phone works normally is the first thing. And sorry, I don't know if it will effect the widevine DRM security level. Don't use it like a toy. Persist means "persist", its data should not be changed after shipping. Only flash it when your persist partition is broken or cannot works properly.
 

AkkulaDz

Member
Jul 8, 2020
14
0
hello,
i have Mi 9T pro i have bug with light and proximity sensor, after flash persist.img with orange fox my sensor work but for few moment and stop work again look at the evidence
 

raptorddd

Senior Member
Jun 13, 2013
6,481
2,326
culiacan
autobrightness is not working for me. after ive flashed fastboot rom .. i noticed that my screen was very bright at nigth. so checked brightness.
manually brightness works ok up and down.. but in auto only works on high settings but it wont go down. or seems to go down but brightess doesnt change..
enter cit presing kernel verion did a test on light sensor. flux sensor goes up and down depending of light but the brightness value doesnt change down only up high.
 

gwgantengcuy

Member
Nov 5, 2020
8
0
Hi, thanks for sharing.

im using mi note 10, im losing the /persist partition directory, somehow it losing after flashing custom rom, how to get it back? Im editing your file and change to my phone original persist.img, and flashing on twrp it end to fastboot bootloop. My sensor are working, but after loosing my /persist directory the fingerprint scanner "cant add fingerprint, try again" Error.

I check at miflash, theres no option to install/create persist.img partition at promram0.xml line to fix this (somehow im suprising about this, because at my old whyred phone theres an option to create the partition), Could you help me solving this?
 
Last edited:

the_weird_aquarian

Senior Member
  • Nov 13, 2016
    396
    202
    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.
     
    • Like
    Reactions: Uluru25

    Top Liked Posts

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