[GUIDE] Recover phone from a formated /efs partition

Search This thread

kaynpayn

Senior Member
Aug 30, 2010
559
162
I'm just writting this because i've recently had this problem. I managed to sort it out by my own but didn't really find it written anywhere, just bits and pieces scavenged from so many pages that might point to a solution (granted, part of my problem was also finding what was really my problem since the phone stopped working so fast i didn't really had the time to get what happened)

I was trying out swap for my S3, i had created a swap partition in my external card and then followed a guide here from xda to use an app called swapper2 (from market) to enable swap. I must have done something wrong because what it did was format my /efs partition instead as if it was a swap partition. Phone stopped working on the spot, obviously, and wouldn't past samsung's bootscreen.
Also, keep in mind while this worked for me there might be other ways of doing this which may be simpler. This is just what i figured for a solution.


When this helps:
- you accidentally formated your /efs partition
- you have a backup from your /efs partition, files copied with root explorer but not an image you can just flash back to the partition.
- your phone boots to download and to recovery but not to main system (which every tutorial i found seemed to assume to be able to do, i just figured their /efs was not as screwed as mine was)
- your recovery won't mount the /efs partition because it expects it to be ext4 but it's formated to something else and it showing the message:
"e: failed to mount /efs (Invalid argument)"


What doesn't work:

- any kind of standard solution like reflashing a stock rom with odin, with or without .pit file, clear EFS, whatever. It will flash, just won't solve since, apparently, nothing touches the /efs partition because it's so sensible. Even custom recoveries do mount it and apparently format and replace every single other partition but the /efs, which is why i had to do it manually.


Solution:
- simply format the /efs partition back to ext4 and copy your backup files there :)


What's needed:
- phone drivers installed on the computer. If you had kies installed, this should be covered already. Think you can't have it running while doing this though. Also, for what's worth, i've done this with windows 8 x64.

- updated android sdk tool, mainly adb. If adb is saying device not connected or not found, you may be using an outdated adb.exe (i was). I used adb.exe that came with this software here:
http://xdaforums.com/showthread.php?t=1308546

- root. If your rom isn't rooted you can always flash CF-root from odin in download mode.
http://xdaforums.com/showthread.php?t=1695238

- busybox, am not really sure if i actually got to need this, think so for the formating tool. Can't hurt to have more options though. This is how to install:
http://www.omappedia.com/wiki/Android_Installing_Busybox_Command_Line_Tools

- custom recovery that allows root through adb, i used Philz which is pretty awesome
http://xdaforums.com/showthread.php?t=2002953

- backup files from your /efs. I had mine unzipped and copied to my externalsd while in windows. They were in an efs folder in the sd card. You can push this through adb to the phone later, but i found this way simpler.


How to:

- get into recovery (vol up+home+power button) and plug your phone to the computer. You'll hear an usb connected sound from windows after a bit.

- in recovery, navigate to Mounts and try the "mount /efs". It'll fail. Now, navigate to advanced and "view log". You'll see below that the phone tried to mount a partition and failed, in my case, it had unsucessfully tried to mount /dev/block/mmcblk0p3 which is the partition /efs uses. Take note of this partition name.

- On windows, open a command line (type cmd on you start menu), navigate to where you have adb.exe and type:
adb shell
If all went well, command prompt has changed. You can now issue commands directly to your phone from terminal.


- type "su" to get root permissions. Your command line should change to something like root@android. Before i had this working i needed to use "Fix permissions". It's an option in the recovery menus on the phone.

- this step is optional but i did it anyway. I created an image of the partition i was going to mess with. If anything went wrong i could always flash it back even if it was broken. By the way, this is what i should have done in the first place instead of just copying /efs files. Would have made the process so much simpler... also, do this if you ever get the phone back working again. Type:

dd if=/dev/block/mmcblk0p3 of=/externalsd/efs.img

The /externalsd/efs.img is just a place you can save stuff to, like your external sd card. You can check what's your mounting point for the card with the command "mount" and look for something relevant like "externalsd".
Also, you may want to copy that efs.img to somewhere else from your phone (like your computer) for safekeeping. Literally remove card from phone, put in computer and copy files there. Notice you may need to reboot phone to recovery if you remove your card so it detects and mounts your card again. Sure, you can also do that from the command line, but it's just easier to reboot the phone.


- Now, we'll format the partition to something your phone can mount (ext4) and is expecting. Be careful, by doing this, you're actually erasing what's left of your partition and replacing by something clean. Type:

mk2fs /dev/block/mmcblk0p3

If all went well, you should see some kind of small report about what was just done.


- To mount this we'll need a mounting point. Type:

mkdir /efs

this will create an /efs folder in root, if it doesn't exist already, and to mount, type:

mount -t ext4 /dev/block/mmcblk0p3 /efs


- if all went well, you now have access to the /efs folder and can copy you files back:

cp -r /externalsd/efs/* /efs

where externalsd was my external sd card mounted on my phone.


- Check if your /efs folder has it's contents properly

ls /efs

I had to reboot the phone to recovery once more at this point and use the "fix permissions" option again.

After this, my phone booted up normally again.
 

Benzonat0r

Senior Member
Sep 4, 2009
1,298
1,256
I'm getting Segmentation fault, I guess there's some kinda hardware error on my phone. Gonna take it to Sammy's tomorrow. :p

Code:
mke2fs -F  /dev/block/mmcblk0p11
Segmentation fault
sh-4.2#
 

Enea307

Senior Member
Oct 25, 2011
313
53
Hi thnx for your Guide. I have the EFS problem, after installin 4 diferent rom in 2 hours my imei and baseband lost.( dont now why) i dont have a backup. I was thinking if it take the EFS from another S3 does it work?
 

Attachments

  • uploadfromtaptalk1364851860526.jpg
    uploadfromtaptalk1364851860526.jpg
    14 KB · Views: 944

iba21

Senior Member
Jul 1, 2010
2,829
1,586
Venice
is normal this output? (i'm meaning the tar.gz unfinding file)

Code:
*****************************************
*              BACKUP EFS               *
*****************************************
WARNING: Do you wish to Continue? (This will make EFS BACKUP) [Y,N]?Y
--- STARTING ----
--- WAITING FOR DEVICE
--- Backup efs image ---
761 KB/s (9357 bytes in 0.012s)
7 KB/s (39 bytes in 0.005s)
SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_
Creating filesystem with parameters:
    Size: 20971520
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 1280
    Inode size: 256
    Journal blocks: 1024
    Label:
    FLEX_BG size: 0
    Blocks: 5120
    Block groups: 1
    Reserved block group size: 0
Created filesystem with 59/1280 inodes and 2432/5120 blocks
40960+0 records in
40960+0 records out
20971520 bytes transferred in 7.271 secs (2884269 bytes/sec)
unknown option -- ZBusyBox v1.19.4-cm9 bionic (2012-02-05 18:40 +0100) multi-cal
l binary.

Usage: tar -[cxtzjahmvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...

Create, extract, or list files from a tar file

Operation:
        c       Create
        x       Extract
        t       List
        f       Name of TARFILE ('-' for stdin/out)
        C       Change to DIR before operation
        v       Verbose
        z       (De)compress using gzip
        j       (De)compress using bzip2
        a       (De)compress using lzma
        O       Extract to stdout
        h       Follow symlinks
        m       Don't restore mtime
        exclude File to exclude
        X       File with names to exclude
        T       File with names to include

2684 KB/s (9962352 bytes in 3.623s)
2805 KB/s (20971520 bytes in 7.299s)
remote object '/sdcard/SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.gz' does n
ot exist

7-Zip (A) 4.65  Copyright (c) 1999-2009 Igor Pavlov  2009-02-03
Scanning


SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.gz:  WARNING: Impossibile trovare
 il file specificato. [COLOR=Red](impossible to find the specify file)[/COLOR]



Creating archive SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.zip

Compressing  getprop.txt
Compressing  SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.raw.img
Compressing  SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.md5


WARNINGS for files:

SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.gz : Impossibile trovare il file
specificato.[COLOR=Red] (impossible to find the specify file)[/COLOR]

----------------
WARNING: Cannot find 1 file
-
-
Finished. Output file is SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS BACKUP
Premere un tasto per continuare . . .
well in the zip there are only the txt + md5 + .raw.img
 

rol331

New member
Apr 3, 2011
1
0
Thanks for this great tutorial. It was my final step to recover my efs partition, without any backup. I copied the efs folder from another device and modified the files according my devices info (bluetooth mac, serial etc). Worked great on my SGS4

By the way I had the same error:

Code:
mke2fs /dev/block/mmcblk0p10
Segmentation fault

You get this error if you run adb shell when you booted to your ROM.

You need to run adb shell in recovery mode
 

michelle1505

Member
May 27, 2010
27
1
Amsterdam
Great tutorial but i hope you can help me, I can't seem to properly find the SDcard. When I type cp -r /externalsd/efs/* /efs
it comes back with cp: can't stat '/sdcard/efs*' : No such file or directory

I cleared my whole sdcard card except for efs directory. I also tried sdcard instead of externalsd but same thing.
 

Blackwatch

Senior Member
Jul 20, 2011
643
81
Denby Dale
I am getting stuck trying to fix this as I have a boot loop or corrupt /efs or something. I have tried to get my phone working by installing my ROM ( Omega v58 ) and also by trying to flash the latest stock 4.3 through Odin v3.09. I havent tried total stock 4.0.3 yet. No matter what I have done though I can't get past the boot logo ( or the walking Omega droid ). My phone just sits there and hangs

I have followed your steps and I have Philz ( 6.07.9.19 ) installed ( but not busybox unless it is sat there somehow from the Omega install ) but when i try to get adb shell running nothing happens or works..as you can see

Capture_zps6dfa6d36.png


What am i doing wrong? OR is my phone totally borked?
 

himanshu73m

New member
Dec 4, 2014
2
0
hi..

I am getting stuck trying to fix this as I have a boot loop or corrupt /efs or something. I have tried to get my phone working by installing my ROM ( Omega v58 ) and also by trying to flash the latest stock 4.3 through Odin v3.09. I havent tried total stock 4.0.3 yet. No matter what I have done though I can't get past the boot logo ( or the walking Omega droid ). My phone just sits there and hangs

I have followed your steps and I have Philz ( 6.07.9.19 ) installed ( but not busybox unless it is sat there somehow from the Omega install ) but when i try to get adb shell running nothing happens or works..as you can see



What am i doing wrong? OR is my phone totally borked?

I have successfully fix my efs partition follwing this thread.
you are receiving such message in cmd. I faced it too.
Sol: Use Philoz Recovery 5.0.
Fix permissions.
there you are.. done..
Philz 6.0 do not have an option for "fix permission".
hope it helps..
 
Jan 3, 2015
14
10
Redmi Note 9
I wrote a script that attempts to recover your nv_data.bin from a corrupted EFS partition for the i9300. Thus if you don't have a backup and your EFS is corrupt, try the script. The script is still in Alpha phase and may not work for other devices. Feedback would be much appreciated.
You can find the script at: https://github.com/chriscz/efs_recover
 

vamshipulumati

New member
Feb 16, 2015
1
0
I dont have /efs backed up

Hi ,

If i dont have /efs backed up , can I copy any other mobile (same model) efs data to my mobile and try?

Thanks and Regards
Vamshi Pulumati
 

boomboomer

Senior Member
Jun 30, 2010
3,904
828
No, it isn't possible and discussion about changing imei is banned on xda.

Take your phone to a service centre and pay then to recode it for you, make sure it works on 4.3 before you pay.
 
  • Like
Reactions: bronyDrake

bronyDrake

Senior Member
Mar 22, 2014
143
41
Kochi
No, it isn't possible and discussion about changing imei is banned on xda.

Take your phone to a service centre and pay then to recode it for you, make sure it works on 4.3 before you pay.

Hey I would like to tell you that a miracle happened for my S3. Yesterday i tried to do same as per in this guide. After taking backup of broken efs backup i tried to clear the efs folder with this command "mk2fs /dev/block/mmcblk0p3"
After that i just flashed 4.4.4 based stock ROM and somehow phone booted up perfectly. No network issues. Bluetooth wifi sim card everything works. IMEI & Serial No is there. But when i'm checking network unlock status it is showing as everything locked. But still I can use everything... I'm amazed.!!!!

Do you have any idea how this happened??
@boomboomer
 

nlssaraiva

New member
Aug 24, 2015
1
0
Same problem with a Samsung gt-i9070 - Galaxy S Advance

Hi!
My i9070 has the same problem, but when i run the command: "mke2fs /dev/block/mmcblk0p3" shows the "Segmentation fault" error message.
Some one can help? :D
Thanks.
 

amanxarwar

New member
Jan 11, 2013
4
0
I'm just writting this because i've recently had this problem. I managed to sort it out by my own but didn't really find it written anywhere, just bits and pieces scavenged from so many pages that might point to a solution (granted, part of my problem was also finding what was really my problem since the phone stopped working so fast i didn't really had the time to get what happened)

I was trying out swap for my S3, i had created a swap partition in my external card and then followed a guide here from xda to use an app called swapper2 (from market) to enable swap. I must have done something wrong because what it did was format my /efs partition instead as if it was a swap partition. Phone stopped working on the spot, obviously, and wouldn't past samsung's bootscreen.
Also, keep in mind while this worked for me there might be other ways of doing this which may be simpler. This is just what i figured for a solution.


When this helps:
- you accidentally formated your /efs partition
- you have a backup from your /efs partition, files copied with root explorer but not an image you can just flash back to the partition.
- your phone boots to download and to recovery but not to main system (which every tutorial i found seemed to assume to be able to do, i just figured their /efs was not as screwed as mine was)
- your recovery won't mount the /efs partition because it expects it to be ext4 but it's formated to something else and it showing the message:
"e: failed to mount /efs (Invalid argument)"


What doesn't work:

- any kind of standard solution like reflashing a stock rom with odin, with or without .pit file, clear EFS, whatever. It will flash, just won't solve since, apparently, nothing touches the /efs partition because it's so sensible. Even custom recoveries do mount it and apparently format and replace every single other partition but the /efs, which is why i had to do it manually.


Solution:
- simply format the /efs partition back to ext4 and copy your backup files there :)


What's needed:
- phone drivers installed on the computer. If you had kies installed, this should be covered already. Think you can't have it running while doing this though. Also, for what's worth, i've done this with windows 8 x64.

- updated android sdk tool, mainly adb. If adb is saying device not connected or not found, you may be using an outdated adb.exe (i was). I used adb.exe that came with this software here:
http://xdaforums.com/showthread.php?t=1308546

- root. If your rom isn't rooted you can always flash CF-root from odin in download mode.
http://xdaforums.com/showthread.php?t=1695238

- busybox, am not really sure if i actually got to need this, think so for the formating tool. Can't hurt to have more options though. This is how to install:
http://www.omappedia.com/wiki/Android_Installing_Busybox_Command_Line_Tools

- custom recovery that allows root through adb, i used Philz which is pretty awesome
http://xdaforums.com/showthread.php?t=2002953

- backup files from your /efs. I had mine unzipped and copied to my externalsd while in windows. They were in an efs folder in the sd card. You can push this through adb to the phone later, but i found this way simpler.


How to:

- get into recovery (vol up+home+power button) and plug your phone to the computer. You'll hear an usb connected sound from windows after a bit.

- in recovery, navigate to Mounts and try the "mount /efs". It'll fail. Now, navigate to advanced and "view log". You'll see below that the phone tried to mount a partition and failed, in my case, it had unsucessfully tried to mount /dev/block/mmcblk0p3 which is the partition /efs uses. Take note of this partition name.

- On windows, open a command line (type cmd on you start menu), navigate to where you have adb.exe and type:
adb shell
If all went well, command prompt has changed. You can now issue commands directly to your phone from terminal.


- type "su" to get root permissions. Your command line should change to something like root@android. Before i had this working i needed to use "Fix permissions". It's an option in the recovery menus on the phone.

- this step is optional but i did it anyway. I created an image of the partition i was going to mess with. If anything went wrong i could always flash it back even if it was broken. By the way, this is what i should have done in the first place instead of just copying /efs files. Would have made the process so much simpler... also, do this if you ever get the phone back working again. Type:

dd if=/dev/block/mmcblk0p3 of=/externalsd/efs.img

The /externalsd/efs.img is just a place you can save stuff to, like your external sd card. You can check what's your mounting point for the card with the command "mount" and look for something relevant like "externalsd".
Also, you may want to copy that efs.img to somewhere else from your phone (like your computer) for safekeeping. Literally remove card from phone, put in computer and copy files there. Notice you may need to reboot phone to recovery if you remove your card so it detects and mounts your card again. Sure, you can also do that from the command line, but it's just easier to reboot the phone.


- Now, we'll format the partition to something your phone can mount (ext4) and is expecting. Be careful, by doing this, you're actually erasing what's left of your partition and replacing by something clean. Type:

mk2fs /dev/block/mmcblk0p3

If all went well, you should see some kind of small report about what was just done.


- To mount this we'll need a mounting point. Type:

mkdir /efs

this will create an /efs folder in root, if it doesn't exist already, and to mount, type:

mount -t ext4 /dev/block/mmcblk0p3 /efs


- if all went well, you now have access to the /efs folder and can copy you files back:

cp -r /externalsd/efs/* /efs

where externalsd was my external sd card mounted on my phone.


- Check if your /efs folder has it's contents properly

ls /efs

I had to reboot the phone to recovery once more at this point and use the "fix permissions" option again.

After this, my phone booted up normally again.

I have restored my s6 edge by following this method. The EFS partition name is "sda3" for s6 edge if anyone want to restore s6 edge. There is typo in command "mk2fs /dev/block/mmcblk0p3" it should be mke2fs i think.

After restoring EFS my phone recovered from boot loop. But the imei is still invalid. Do you know any method to repair imei for s6 edge?. Thank You

---------- Post added at 02:18 PM ---------- Previous post was at 02:14 PM ----------

I am getting stuck trying to fix this as I have a boot loop or corrupt /efs or something. I have tried to get my phone working by installing my ROM ( Omega v58 ) and also by trying to flash the latest stock 4.3 through Odin v3.09. I havent tried total stock 4.0.3 yet. No matter what I have done though I can't get past the boot logo ( or the walking Omega droid ). My phone just sits there and hangs

I have followed your steps and I have Philz ( 6.07.9.19 ) installed ( but not busybox unless it is sat there somehow from the Omega install ) but when i try to get adb shell running nothing happens or works..as you can see

Capture_zps6dfa6d36.png


What am i doing wrong? OR is my phone totally borked?

You don't have to run "su" command. "#" shows you already have root access.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    I'm just writting this because i've recently had this problem. I managed to sort it out by my own but didn't really find it written anywhere, just bits and pieces scavenged from so many pages that might point to a solution (granted, part of my problem was also finding what was really my problem since the phone stopped working so fast i didn't really had the time to get what happened)

    I was trying out swap for my S3, i had created a swap partition in my external card and then followed a guide here from xda to use an app called swapper2 (from market) to enable swap. I must have done something wrong because what it did was format my /efs partition instead as if it was a swap partition. Phone stopped working on the spot, obviously, and wouldn't past samsung's bootscreen.
    Also, keep in mind while this worked for me there might be other ways of doing this which may be simpler. This is just what i figured for a solution.


    When this helps:
    - you accidentally formated your /efs partition
    - you have a backup from your /efs partition, files copied with root explorer but not an image you can just flash back to the partition.
    - your phone boots to download and to recovery but not to main system (which every tutorial i found seemed to assume to be able to do, i just figured their /efs was not as screwed as mine was)
    - your recovery won't mount the /efs partition because it expects it to be ext4 but it's formated to something else and it showing the message:
    "e: failed to mount /efs (Invalid argument)"


    What doesn't work:

    - any kind of standard solution like reflashing a stock rom with odin, with or without .pit file, clear EFS, whatever. It will flash, just won't solve since, apparently, nothing touches the /efs partition because it's so sensible. Even custom recoveries do mount it and apparently format and replace every single other partition but the /efs, which is why i had to do it manually.


    Solution:
    - simply format the /efs partition back to ext4 and copy your backup files there :)


    What's needed:
    - phone drivers installed on the computer. If you had kies installed, this should be covered already. Think you can't have it running while doing this though. Also, for what's worth, i've done this with windows 8 x64.

    - updated android sdk tool, mainly adb. If adb is saying device not connected or not found, you may be using an outdated adb.exe (i was). I used adb.exe that came with this software here:
    http://xdaforums.com/showthread.php?t=1308546

    - root. If your rom isn't rooted you can always flash CF-root from odin in download mode.
    http://xdaforums.com/showthread.php?t=1695238

    - busybox, am not really sure if i actually got to need this, think so for the formating tool. Can't hurt to have more options though. This is how to install:
    http://www.omappedia.com/wiki/Android_Installing_Busybox_Command_Line_Tools

    - custom recovery that allows root through adb, i used Philz which is pretty awesome
    http://xdaforums.com/showthread.php?t=2002953

    - backup files from your /efs. I had mine unzipped and copied to my externalsd while in windows. They were in an efs folder in the sd card. You can push this through adb to the phone later, but i found this way simpler.


    How to:

    - get into recovery (vol up+home+power button) and plug your phone to the computer. You'll hear an usb connected sound from windows after a bit.

    - in recovery, navigate to Mounts and try the "mount /efs". It'll fail. Now, navigate to advanced and "view log". You'll see below that the phone tried to mount a partition and failed, in my case, it had unsucessfully tried to mount /dev/block/mmcblk0p3 which is the partition /efs uses. Take note of this partition name.

    - On windows, open a command line (type cmd on you start menu), navigate to where you have adb.exe and type:
    adb shell
    If all went well, command prompt has changed. You can now issue commands directly to your phone from terminal.


    - type "su" to get root permissions. Your command line should change to something like root@android. Before i had this working i needed to use "Fix permissions". It's an option in the recovery menus on the phone.

    - this step is optional but i did it anyway. I created an image of the partition i was going to mess with. If anything went wrong i could always flash it back even if it was broken. By the way, this is what i should have done in the first place instead of just copying /efs files. Would have made the process so much simpler... also, do this if you ever get the phone back working again. Type:

    dd if=/dev/block/mmcblk0p3 of=/externalsd/efs.img

    The /externalsd/efs.img is just a place you can save stuff to, like your external sd card. You can check what's your mounting point for the card with the command "mount" and look for something relevant like "externalsd".
    Also, you may want to copy that efs.img to somewhere else from your phone (like your computer) for safekeeping. Literally remove card from phone, put in computer and copy files there. Notice you may need to reboot phone to recovery if you remove your card so it detects and mounts your card again. Sure, you can also do that from the command line, but it's just easier to reboot the phone.


    - Now, we'll format the partition to something your phone can mount (ext4) and is expecting. Be careful, by doing this, you're actually erasing what's left of your partition and replacing by something clean. Type:

    mk2fs /dev/block/mmcblk0p3

    If all went well, you should see some kind of small report about what was just done.


    - To mount this we'll need a mounting point. Type:

    mkdir /efs

    this will create an /efs folder in root, if it doesn't exist already, and to mount, type:

    mount -t ext4 /dev/block/mmcblk0p3 /efs


    - if all went well, you now have access to the /efs folder and can copy you files back:

    cp -r /externalsd/efs/* /efs

    where externalsd was my external sd card mounted on my phone.


    - Check if your /efs folder has it's contents properly

    ls /efs

    I had to reboot the phone to recovery once more at this point and use the "fix permissions" option again.

    After this, my phone booted up normally again.
    1
    No, it isn't possible and discussion about changing imei is banned on xda.

    Take your phone to a service centre and pay then to recode it for you, make sure it works on 4.3 before you pay.