[GUIDE] EFS Partitions: What They Are And How To Get It Back If Lost

PlayingPoise

Senior Member
May 7, 2013
419
151
0
Wolcott
Hello. My name is Poise, and I'm a victim of EFS Corruption.

I know, laugh it up.

Anyways, you're either here because you don't know what the EFS is and you wanna know, you ruined your EFS and you're looking for redemption, or you just wanna see me ramble. Whichever the case, I figured I'd write this so nobody else has to deal with the looming fear of your 300 dollar phone with infamously-bad customer support becoming a worthless, barely functioning phone, if not a big 300 dollar brick.
Before I go on, I wanna mention that this guide applies for most if not all phones, not necessarily just the OPO. So if anyone is losing their mind over a corrupted or lost EFS partition, this should get them on the right track to at least understanding the problem.

BACKGROUND: AKA "WHAT IS THE EFS AND WHY DO I EVEN CARE"

EFS stands for Encrypted File System. Imagine the EFS as a big folder containing all of the important stuff that makes the "phone" part of your phone (i.e. what lets you communicate from one person with a phone to another) tick. It contains your IMEI, lots of files revolving around your SIM card and Wifi/Bluetooth (this includes your MAC address for all the radios of your phone), and lots of other things that should never ever under any circumstance be deleted or touched. It's sensitive, it's devastatingly important, and it's a huge pain. If you lose your EFS folder, you lose pretty much any chance of your phone being able to use data, Wifi, Bluetooth, and (in my case) your phone will just not wanna respond and reboot quite a lot.

CHAPTER 1: AKA "THAT SOUNDS LIKE GARBAGE HOW CAN I FIX THIS"

So, like all nice and important things that we have on Android, we can back this folder up, assuming you're rooted and with a custom recovery (though quite frankly if you're not rooted/installing ROMs I have zero idea how you'd corrupt your EFS). I'd recommend doing it through a nandroid backup (TWRP usually has the option to backup EFS, if not there's an unofficial version for bacon that can), but there are other apps that do the job quite nicely. Backing up your EFS is just as essential as backing up your previous ROM; in fact, backing up your EFS is MILES MORE ESSENTIAL because you can just flash a ROM over a corrupted system to get it working. There is no "flashable EFS"; if it were that easy, it wouldn't be so sensitive, and I wouldn't be writing this guide.

CHAPTER 2: AKA "I'M SUPER CAREFUL BRO I'LL NEVER MESS UP MY EFS PARTITION, WHY BOTHER"

Do it anyways.

I installed a ROM, realized my gapps package was screwed up, restored a CM13 backup, and realized my SIM card wasn't being detected. My phone would lag like hell, and after a while it'd just crash and reboot. I had no IMEI, I had no SIM card detection. I knew exactly what it meant. It wasn't fun to restore it.

If ROM installations were perfect, we wouldn't really have to backup anything. But, sometimes a hiccup will occur, something will touch something else that it shouldn't, and chaos ensues. So, if you don't wanna take 4 hours out of your day to hope to Christ that you didn't royally ruin your phone and the restoring method worked, just back it up. It's like, 3MB and it'll save so much frustration. Honestly.

CHAPTER 3: AKA "YEAH ABOUT THAT MY EFS IS ALREADY CORRUPTED, PLS HELP"

Congrats, you did it! Don't feel too bad, it happens to the best of us. :crying:

Fixing an EFS on the Oneplus One is pretty easy, but really time consuming and riveting because it might not 100% of the time work. You'll need the following:

  1. Some sort of ADB/fastboot program. I use Minimal ADB and Fastboot, which rarely has any problems, but you can use whatever as long as it'll talk to your device.
  2. Your near-dead Oneplus One.
  3. A few hours of your time.
  4. Some sort of backup of your data, you'll be factory resetting.
  5. OxygenOS. Preferrably, a package that can be flashed in TWRP. I won't find that for you.
  6. An unlocked bootloader. I cannot stress how important this is. If you don't know what this is, do some research before trying to fix your ruined EFS. Again, how you'd have even ruined it with a locked bootloader is beyond me...
  7. TWRP 2.8.6.0. Yes, it has to be this version; this is the only one that can install firmware correctly. The unofficial modified 2.8.7.0 might be able to, but I'm not about to try it.
  8. Competence and good reading skills. Do everything exactly as I wrote it.
  9. Some knowledge on how flashing a ROM works.
  10. A modified persist.img file that we'll be flashing. You can find it in this thread. Download the Never Settle package and take out the persist.img file; we don't care about the rest. Whether this is mandatory or not, I don't know, but I used it and it worked fine so I'll include it. If anyone tries this without the persist file and it works, let me know. Thanks a ton to markbensze for making this, he saved my skin.

Now for how it's done:

  1. To start, we gotta put your phone into fastboot mode. Do this by holding the power button and the up volume button as you're turning your phone on. You'll know it worked when the phone very dimly says "Fastboot Mode".
  2. Plug your phone into your computer. Let it do any driver stuff it has to, then open your ADB/Fastboot program. Type "fastboot devices", if you see a bunch of letters/numbers with the word "fastboot" a few spaces away, you're set.
  3. Seriously, if your bootloader isn't unlocked, you gotta do that. This will wipe EVERTHING from your phone, including any backups. I won't cover that mess, there's trillions of guides for that.
  4. Type the following commands:
    • Code:
      fastboot erase modemst1
      fastboot erase modemst2
      fastboot erase persist
  5. This erases a bunch of partitions that have to do with the EFS. They all regenerate themselves, but as an added precaution we're gonna flash that persist.img you got from the thread in the "what you need" list. In order to do this, enter the following command:
    • Code:
      fastboot flash persist [location to your persist.img on your computer]
  6. If all goes well, you'll get a handy success message and you can get out of fastboot mode by holding down the power button until it turns off.
  7. Now, reboot to recovery; do this by holding the power button and holding the down volume button as you turn your phone on, until you see the TWRP splash screen.
  8. How you do this next step is up to you; you can use the built-in MTP to transfer the Oxygen OS file over from your computer to your phone, or you can use ADB sideload. If you don't know how sideload works, just transfer it over.
  9. Factory reset as you would installing a normal ROM, and flash Oxygen OS through the install menu/sideload/however you wanna. Let it fully install.
  10. Reboot. Let it boot, pray to the EFS gods that they'll give you their blessing, and check if your SIM card gets detected.

If it did, congradulations! Your EFS is working. Now, go make a backup while you can.
 

Gawd

Senior Member
Jan 26, 2015
1,248
1,816
0
Very glad that you made a guide about it. I didn't f*** up my phone though, but I truly got the importance of backing up the EFS. Also, got to know about it a bit more. :)

Thanks!
 

FL4NKENSTEIN

Member
Jul 4, 2015
44
20
0
Ruston, La
It worked. After I did this I kept getting boot Loops what was progress on this phone. I did the factory reset in recovery. Let it bootloop some more. Went back to recovery and fixed selinux permissions. Boot Loops again, went back to recovery wipe the dalvik. now it freaking works.
 

sarmadical

Senior Member
Aug 9, 2012
69
2
0
First off, great guide.

But after following this, despite having my IMEI shown previously, my baseband and my imei are now gone. I was told to use this guide to try and fix my data connection problems as it seemed something was wrong with my EFS partition, but it seems following this has left me worse off.

Any suggestions to what else I could do?
 

sarmadical

Senior Member
Aug 9, 2012
69
2
0
Is there a stock oxygen OS file kicking around somewhere? I tried searching for them, but most are modified by other people. One of them hardbricked my phone (the ported Oneplus X oxygen os), so I'd rather not further experiment with other modified ones. I used another OxygenOs file, but despite booting, it didn't fix the baseband or IMEI problem.

I tried doing this but using stock CM13.1.2 instead of OxygenOS, but it didn't fix the problem either. So any other suggestions?

Edit: Nvm, found the official from the OnePlus website, I'm an idiot, going to try doing this with Oxygen to see what happens.
 
Last edited:

crenshaw1979

Senior Member
Dec 4, 2009
80
6
0
FAILED (remote: Partition flashing is not allowed)

OnePlus 3t with TWRP BlueSpark 3.2.1 recovery.

I am open to flash Roms with TWRP with no problem but I am not able to flash persist.zip (TWRP version) it says it flash but folder doesn't appear and your instructions via fast boot I get the following error.

C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot flash persist c:\android\persist.zip
target reported max download size of 435159040 bytes
sending 'persist' (344 KB)...
OKAY [ 0.036s]
writing 'persist'...
FAILED (remote: Partition flashing is not allowed) <------ Problem here or or is my partition on my phone messed up?
finished. total time: 0.057s

I any suggestions for fixing my WiFi/Bluetooth problem?
 

crenshaw1979

Senior Member
Dec 4, 2009
80
6
0
Fastboot commands not working, ADB way of doing it?

Hello. My name is Poise, and I'm a victim of EFS Corruption.

I know, laugh it up.

Anyways, you're either here because you don't know what the EFS is and you wanna know, you ruined your EFS and you're looking for redemption, or you just wanna see me ramble. Whichever the case, I figured I'd write this so nobody else has to deal with the looming fear of your 300 dollar phone with infamously-bad customer support becoming a worthless, barely functioning phone, if not a big 300 dollar brick.
Before I go on, I wanna mention that this guide applies for most if not all phones, not necessarily just the OPO. So if anyone is losing their mind over a corrupted or lost EFS partition, this should get them on the right track to at least understanding the problem.

BACKGROUND: AKA "WHAT IS THE EFS AND WHY DO I EVEN CARE"

EFS stands for Encrypted File System. Imagine the EFS as a big folder containing all of the important stuff that makes the "phone" part of your phone (i.e. what lets you communicate from one person with a phone to another) tick. It contains your IMEI, lots of files revolving around your SIM card and Wifi/Bluetooth (this includes your MAC address for all the radios of your phone), and lots of other things that should never ever under any circumstance be deleted or touched. It's sensitive, it's devastatingly important, and it's a huge pain. If you lose your EFS folder, you lose pretty much any chance of your phone being able to use data, Wifi, Bluetooth, and (in my case) your phone will just not wanna respond and reboot quite a lot.

CHAPTER 1: AKA "THAT SOUNDS LIKE GARBAGE HOW CAN I FIX THIS"

So, like all nice and important things that we have on Android, we can back this folder up, assuming you're rooted and with a custom recovery (though quite frankly if you're not rooted/installing ROMs I have zero idea how you'd corrupt your EFS). I'd recommend doing it through a nandroid backup (TWRP usually has the option to backup EFS, if not there's an unofficial version for bacon that can), but there are other apps that do the job quite nicely. Backing up your EFS is just as essential as backing up your previous ROM; in fact, backing up your EFS is MILES MORE ESSENTIAL because you can just flash a ROM over a corrupted system to get it working. There is no "flashable EFS"; if it were that easy, it wouldn't be so sensitive, and I wouldn't be writing this guide.

CHAPTER 2: AKA "I'M SUPER CAREFUL BRO I'LL NEVER MESS UP MY EFS PARTITION, WHY BOTHER"

Do it anyways.

I installed a ROM, realized my gapps package was screwed up, restored a CM13 backup, and realized my SIM card wasn't being detected. My phone would lag like hell, and after a while it'd just crash and reboot. I had no IMEI, I had no SIM card detection. I knew exactly what it meant. It wasn't fun to restore it.

If ROM installations were perfect, we wouldn't really have to backup anything. But, sometimes a hiccup will occur, something will touch something else that it shouldn't, and chaos ensues. So, if you don't wanna take 4 hours out of your day to hope to Christ that you didn't royally ruin your phone and the restoring method worked, just back it up. It's like, 3MB and it'll save so much frustration. Honestly.

CHAPTER 3: AKA "YEAH ABOUT THAT MY EFS IS ALREADY CORRUPTED, PLS HELP"

Congrats, you did it! Don't feel too bad, it happens to the best of us. :crying:

Fixing an EFS on the Oneplus One is pretty easy, but really time consuming and riveting because it might not 100% of the time work. You'll need the following:

  1. Some sort of ADB/fastboot program. I use Minimal ADB and Fastboot, which rarely has any problems, but you can use whatever as long as it'll talk to your device.
  2. Your near-dead Oneplus One.
  3. A few hours of your time.
  4. Some sort of backup of your data, you'll be factory resetting.
  5. OxygenOS. Preferrably, a package that can be flashed in TWRP. I won't find that for you.
  6. An unlocked bootloader. I cannot stress how important this is. If you don't know what this is, do some research before trying to fix your ruined EFS. Again, how you'd have even ruined it with a locked bootloader is beyond me...
  7. TWRP 2.8.6.0. Yes, it has to be this version; this is the only one that can install firmware correctly. The unofficial modified 2.8.7.0 might be able to, but I'm not about to try it.
  8. Competence and good reading skills. Do everything exactly as I wrote it.
  9. Some knowledge on how flashing a ROM works.
  10. A modified persist.img file that we'll be flashing. You can find it in this thread. Download the Never Settle package and take out the persist.img file; we don't care about the rest. Whether this is mandatory or not, I don't know, but I used it and it worked fine so I'll include it. If anyone tries this without the persist file and it works, let me know. Thanks a ton to markbensze for making this, he saved my skin.

Now for how it's done:

  1. To start, we gotta put your phone into fastboot mode. Do this by holding the power button and the up volume button as you're turning your phone on. You'll know it worked when the phone very dimly says "Fastboot Mode".
  2. Plug your phone into your computer. Let it do any driver stuff it has to, then open your ADB/Fastboot program. Type "fastboot devices", if you see a bunch of letters/numbers with the word "fastboot" a few spaces away, you're set.
  3. Seriously, if your bootloader isn't unlocked, you gotta do that. This will wipe EVERTHING from your phone, including any backups. I won't cover that mess, there's trillions of guides for that.
  4. Type the following commands:
    • Code:
      fastboot erase modemst1
      fastboot erase modemst2
      fastboot erase persist
  5. This erases a bunch of partitions that have to do with the EFS. They all regenerate themselves, but as an added precaution we're gonna flash that persist.img you got from the thread in the "what you need" list. In order to do this, enter the following command:
    • Code:
      fastboot flash persist [location to your persist.img on your computer]
  6. If all goes well, you'll get a handy success message and you can get out of fastboot mode by holding down the power button until it turns off.
  7. Now, reboot to recovery; do this by holding the power button and holding the down volume button as you turn your phone on, until you see the TWRP splash screen.
  8. How you do this next step is up to you; you can use the built-in MTP to transfer the Oxygen OS file over from your computer to your phone, or you can use ADB sideload. If you don't know how sideload works, just transfer it over.
  9. Factory reset as you would installing a normal ROM, and flash Oxygen OS through the install menu/sideload/however you wanna. Let it fully install.
  10. Reboot. Let it boot, pray to the EFS gods that they'll give you their blessing, and check if your SIM card gets detected.

If it did, congradulations! Your EFS is working. Now, go make a backup while you can.
Is there a way to replicate your 3 fastboot commands, using ADB? My bootloader is unlocked and running the latest TWRP recovery 3.2.2

My results via fastboot
"
fastboot erase modemst1
erasing 'modemst1'...
FAILED (remote: Partition flashing is not allowed)
finished. total time: 0.024s
"
 
Last edited:

Byteman3D

Senior Member
Mar 1, 2014
53
5
28
Istanbul
www.nezihkanbur.com
I have a Samsung Galaxy Note 2 phone with a broken logic board. I need to replace, but I may need to change the IMEI of the replacement board with my old phone's IMEI if I buy the replacement board from China.
Does the IMEI number pass to the other phone if I restore my Twrp backup which contains all partitions (more specifically the EFS partition), over this motherboard? Does it solve my problem.
 

Natizyskunk

Member
May 19, 2016
5
0
0
Same EFS partition over time ? after updating Android ?

Thx a lot, this has saved me a lot of troubles ^^
Was just wondering, is the EFS partition always the same over time ? modemst1 & modemst2 files are the same for all Android/OxygenOS version ?
I've backed up mine under OxygenOS 3.2.8 and I was wondering if i could still use it to restore the EFS partition if anything goes wrong ?

PS : Sorry for my bad english, it's not my native language ^^

---------- Post added at 09:28 PM ---------- Previous post was at 09:26 PM ----------

Is there a way to replicate your 3 fastboot commands, using ADB? My bootloader is unlocked and running the latest TWRP recovery 3.2.2

My results via fastboot
"
fastboot erase modemst1
erasing 'modemst1'...
FAILED (remote: Partition flashing is not allowed)
finished. total time: 0.024s
"
You can find how to do it on this thread : https://www.theandroidsoul.com/fix-...d-wifibluetooth-issues-restoring-twrp-backup/
 

SairesArt

Member
May 22, 2015
49
5
28
EFS / Modem backup option gone?

hey there :]
I want to backup my phone. In TWRP I had the option to backup EFS and modem partitions. I decided to upgrade TWRP, since my version (3.2.x) was older than the most recent (3.4). After flashing the .img from inside TWRP, everything function as expected... however, the option to backup EFS and Modem is gone.
I downgraded to older version of TWRP, but TWRP still does not show the option for EFS and modem backups.
recovery.log, that was created when I made the TWRP backup lists "Unable to locate '/modem_st1' partition for backup calculations."
What did I do wrong? Does bacon require some extra step to unlock EFS and modem access for TWRP?