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

[REF] Backup /efs folder. IMPORTANT.

Search This thread

Rawat

Senior Member
Jun 7, 2010
765
542
London
This guide is based on a guide by Candanga on the i9000 forums, and some commands from supercurio
Please hit thanks on their posts and show them some love for the write up.

-----------------------------------------------------------------------------------------------------------------------

I’ve compiled a quick guide to instruct how to make a copy of the /efs folder. I’ve found in many threads suggestions about backing up this folder but the methods itself are very general. Most of the times they suggest to “root and copy the folder” with Root Explorer or similar, but usually it’s not that easy or it just doesn't work for everyone.

This guide ASUMES you have read this Excellent Guide by Darkstrikerfirst:
H E R E <-- Make sure to read the ADB Guide.

I recommend doing this with a Mobile just taken out of the box or with any Official ROM of its Service Provider. If you have already Flashed your phone with another ROM but its working fine, then you can use that /efs also.

Why the /efs folder?
This is a very sensitive system folder that contains Phone-specific information such as the IMEI (encrypted in the nv_data.bin), wireless devices MAC addresses, product code (also in the nv_data.bin), and much more. Often users trying to change product codes or trying to unlock the mobile will end up corrupting data in this location.

Why back it up?
Well, let’s resume it saying that backing-up this little folder will keep you away from Samsung service centres.

***WARNING: I take no responsibility to any damage caused by the methods cited and/or written here. Their sole purpose is to back-up data and not to alter in any way the integrity of the original files of the mobile***

What you will need:

  • Rooted SGS II to get permissions as a SU (Super User) and perform the backup
  • I would suggest learning a little about the terminal commands used (in case you are not familiar with them), as it’s better to know what you are doing rather than typing strings like a little chimp without knowing what they are; if you are a little lazy, then you have a good chance bricking your mobile. <- Busybox Commands(or Google them)

The standard prompt of terminal (adb) is a $ sign. Once you enter “SU” it will become a # Sign.

***NOTE: Make sure to keep an eye on the screen of your SGS II during this process, because it may request SU permissions [currently doesn't on CF-root]; else, you will get an error (just if it’s the first time). In Terminal Emulator you will need to reset the app after granting permissions cause it usually freezes***

*Remember: to use ADB you need to enable USB DEBUGGING under Applications/Development in your SGS II.

Here are 3 methods, I recommend that you do both Clean and RAW.

Basic, unix permissions lost :
Code:
su
busybox cp -a /efs /sdcard/efs/

Clean :
Code:
su
busybox tar zcvf /sdcard/efs/efs-backup.tar.gz /efs

After this, you will end up with the file efs-backup.tar.gz in your INTERNAL SDCARD in sdcard/efs/, which is a “tarball” or a ZIP of the /efs folder. That file is your backup. You can expand it with Winrar.

You can also back up the mmcblk0p1 (where /efs is stored) under /dev/block which can greatly support in recovering your IMEI in case of a screw-up:

RAW :
Code:
su 
cat /dev/block/mmcblk0p1 > /sdcard/efs/efs_dev-block-mmcblk0p1.img

Same thing, the target is the INTERNAL SDCARD in sdcard/efs/, so go ahead and copy the file.
 
Last edited:

JJEgan

Senior Member
Oct 24, 2010
30,293
5,889
Can this not be tasked by using a root file explorer and copying efs folder as i have always done .

jje
 

Rawat

Senior Member
Jun 7, 2010
765
542
London
Can this not be tasked by using a root file explorer and copying efs folder as i have always done .

jje
From the thread:
I’ve found in many threads suggestions about backing up this folder but the methods itself are very general. Most of the times they suggest to “root and copy the folder” with Root Explorer or similar, but usually it’s not that easy or it just doesn't work for everyone.
And just copying the folder won't preserve permissions etc.
 
Last edited:

JJEgan

Senior Member
Oct 24, 2010
30,293
5,889
As long as you don't copy it to /sdcard, because it's VFAT and you'll lose the permissions settings on the files. If you copy it to /data or something then that's fine.

Thanks the SGS 1 EFs i copied was copied to external sd card and then copied off to PC . Did likewise on SGS 2 using Super Manager .
So according to what you are saying that was not going to back up if needed .

jje
 

RyanZA

Senior Member
Jan 21, 2006
2,023
779
JHB
Thanks the SGS 1 EFs i copied was copied to external sd card and then copied off to PC . Did likewise on SGS 2 using Super Manager .
So according to what you are saying that was not going to back up if needed .

jje

It would probably have worked, but it would have made your EFS files readable and writable by any app that tried - not the end of the world since it's unlikely that any apps would try, but you still might as well avoid it if you can. I don't think there are any executables in EFS or anything that this will actually break though.
 
  • Like
Reactions: JJEgan

JJEgan

Senior Member
Oct 24, 2010
30,293
5,889
Thanks i did lose IMEI at one flash on SGS1 but a second flash recovered it .
I do like full backup of original firmware and anything else before playing with phone .

jje
 

ke3pup

Senior Member
Jan 3, 2010
155
17
thanks for the info. have had close calls previously and having backups would have helped ease the stress
 

vijayvasa

Senior Member
May 5, 2007
247
12
Vodafone Fimrware backup BUKE1

Guys,

Have got a new samsung from Vodafone UK , but the firmware kernel seems a bit different, BUKE1. Is this something now and is the above method correct to backup the entire firmware so that it might be useful for vodafone samsung users. Is there an easy guide to backup the firmware ?

Regards
VJ
 

stBlueJay

Senior Member
Nov 21, 2009
83
5
Cardiff
Guys can someone give me a bit of advice pleeeease :D

I followed this guide but am a bit worried i might have messed it up, i'm comfortable with command prompt as i'm a software dev but haven't used linux commands much.

Anyway i used the ADB shell from the Android SDK tools and entered the first command to backup the efs directory to the internal sdcard....

Basic, unix permissions lost :
Code:
su
busybox cp -a /efs /sdcard/efs/

And i got a lot of
Code:
cp: can't preserve ownership of 'sdcard/efs/...' : Operation not permitted
messages flashing up?

However i checked to see if the backup had been made and it had? What does this mean?

Next i compressed it using...
Clean :
Code:
su
busybox tar zcvf /sdcard/efs/efs-backup.tar.gz /efs

Which seemed to work as i have the file in the place i expect

When i did the next step...

You can also back up the mmcblk0p1 (where /efs is stored) under /dev/block which can support greatly to recover your IMEI in case of a screw-up:

RAW :
Code:
su 
cat /dev/block/mmcblk0p1 > /sdcard/efs_dev-block-mmcblk0p1.img

Same thing, the target is the INTERNAL SDCARD in sdcard/efs/, so go ahead and copy the file.

It completed really quickly, with no messages telling me it was done but when i checked root explorer i couldn't find /dev/block/mmcblk0p1?

What has it done with it? I have dev/block/ but there is no mmcblk0p1? Although i do have /sdcard/efs_dev-block-mmcblk0p1.img. Should i have both?

From what i understand cat concatenates files and prints them to standard output, so i'm assuming the > is piping the std output to the internal sdcard?

Sorry for the questions but i thought i understood what i was doing but the last step and the "can't preserve ownership of.." messages from the first step threw me :confused:

Could someone explain this to me a little ;p
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    61.6 KB · Views: 1,198

simion_levi

Member
Jan 21, 2009
36
6
These aren't steps but rather separate methods achieving different things. Don't bother about the first one - it notes unix permissions lost , which is why you are seeing the can't preserve ownership messages. The files still backup but correct r/w permissions do not. You may as well chuck the files really, since you managed the tarball (second instruction). Just grab this and backup to external storage, in case you ever need it.

The raw backup will be under sdcard as you have found - stash this away somewhere safe too. You won't find mmcblk0p1 in root explorer as it is a partition, not a folder.
 

stBlueJay

Senior Member
Nov 21, 2009
83
5
Cardiff
Thanks for the swift reply simion_levi :D

These aren't steps but rather separate methods achieving different things. Don't bother about the first one - it notes unix permissions lost , which is why you are seeing the can't preserve ownership messages. The files still backup but correct r/w permissions do not. You may as well chuck the files really, since you managed the tarball (second instruction). Just grab this and backup to external storage, in case you ever need it.

Do if i move the tarball to the external drive i can get rid of the sdcard/efs directory i copied to the internal card? The tarball has all the correct permissions?

The raw backup will be under sdcard as you have found - stash this away somewhere safe too. You won't find mmcblk0p1 in root explorer as it is a partition, not a folder.
Ok i didn't realise it was a partition, so i've just created an image of the partition that the efs folder resides on? Should i copy this to my external sd card as well?

Cheers brother ;)
 

simion_levi

Member
Jan 21, 2009
36
6
No problem! Yes, you've got it - backup the tarball and the partition image to computers, external drives etc so you can recover back to the phone in case of future catastrophe. The sdcard/efs directory can be deleted as the tarball contains exactly the same files (but with correct permissions).
 

stBlueJay

Senior Member
Nov 21, 2009
83
5
Cardiff
Awesome, will get it done later. Out of interest how do you recover the partition image in the event of a disaster occurring?

Sent from my GT-I9100 using XDA App
 

theobabis

Member
Jul 24, 2007
32
1
One question please, since i stumbled on this one almost by luck.
Is there anything else to save before departing from stock?
Thanks.
 

Enyan

Member
May 27, 2011
34
6
Okay, so this guide assumes I already rooted my phone, but as a newbie I am completely in the dark about what does and what does not potentially harm the /efs. I would rather backup EVERYTHING before I flash/change anything, but from what I have read so far I need at least root to do backups.

Would it be safe to flash the Lite'ning Rom v1.1, coming from stock I9100XWKE2/I9100XENKE1/I9100XXKDJ/I9100XWKE2, and then backup mmcblk0p1?

Thanks!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 93
    This guide is based on a guide by Candanga on the i9000 forums, and some commands from supercurio
    Please hit thanks on their posts and show them some love for the write up.

    -----------------------------------------------------------------------------------------------------------------------

    I’ve compiled a quick guide to instruct how to make a copy of the /efs folder. I’ve found in many threads suggestions about backing up this folder but the methods itself are very general. Most of the times they suggest to “root and copy the folder” with Root Explorer or similar, but usually it’s not that easy or it just doesn't work for everyone.

    This guide ASUMES you have read this Excellent Guide by Darkstrikerfirst:
    H E R E <-- Make sure to read the ADB Guide.

    I recommend doing this with a Mobile just taken out of the box or with any Official ROM of its Service Provider. If you have already Flashed your phone with another ROM but its working fine, then you can use that /efs also.

    Why the /efs folder?
    This is a very sensitive system folder that contains Phone-specific information such as the IMEI (encrypted in the nv_data.bin), wireless devices MAC addresses, product code (also in the nv_data.bin), and much more. Often users trying to change product codes or trying to unlock the mobile will end up corrupting data in this location.

    Why back it up?
    Well, let’s resume it saying that backing-up this little folder will keep you away from Samsung service centres.

    ***WARNING: I take no responsibility to any damage caused by the methods cited and/or written here. Their sole purpose is to back-up data and not to alter in any way the integrity of the original files of the mobile***

    What you will need:

    • Rooted SGS II to get permissions as a SU (Super User) and perform the backup
    • I would suggest learning a little about the terminal commands used (in case you are not familiar with them), as it’s better to know what you are doing rather than typing strings like a little chimp without knowing what they are; if you are a little lazy, then you have a good chance bricking your mobile. <- Busybox Commands(or Google them)

    The standard prompt of terminal (adb) is a $ sign. Once you enter “SU” it will become a # Sign.

    ***NOTE: Make sure to keep an eye on the screen of your SGS II during this process, because it may request SU permissions [currently doesn't on CF-root]; else, you will get an error (just if it’s the first time). In Terminal Emulator you will need to reset the app after granting permissions cause it usually freezes***

    *Remember: to use ADB you need to enable USB DEBUGGING under Applications/Development in your SGS II.

    Here are 3 methods, I recommend that you do both Clean and RAW.

    Basic, unix permissions lost :
    Code:
    su
    busybox cp -a /efs /sdcard/efs/

    Clean :
    Code:
    su
    busybox tar zcvf /sdcard/efs/efs-backup.tar.gz /efs

    After this, you will end up with the file efs-backup.tar.gz in your INTERNAL SDCARD in sdcard/efs/, which is a “tarball” or a ZIP of the /efs folder. That file is your backup. You can expand it with Winrar.

    You can also back up the mmcblk0p1 (where /efs is stored) under /dev/block which can greatly support in recovering your IMEI in case of a screw-up:

    RAW :
    Code:
    su 
    cat /dev/block/mmcblk0p1 > /sdcard/efs/efs_dev-block-mmcblk0p1.img

    Same thing, the target is the INTERNAL SDCARD in sdcard/efs/, so go ahead and copy the file.
    13
    Hi guys :)

    I just finished my little companion tool for my kernel, it can also dump/backup and flash/restore the EFS via a simple tap onto a button.
    (requires root, of course!)

    Maybe some might find it usefull:
    kTool.apk

    (click for larger view)

    More details about it in my kernel thread.
    4
    I have made a one click backup and restore tool especially for EFS which I will be releasing soon. It can backup efs to sdcard and also provides functions to backup and restore from pc. I will create a new thread in due course. Hope this will help alot of people out there! :)

    Sent from my GT-I9100 using Tapatalk
    4
    Just use the terminal app, then

    su
    mkdir /sdcard/efs
    busybox tar zcvf /sdcard/efs/efs-backup.tar.gz /efs
    cat /dev/block/mmcblk0p1 > /sdcard/efs/efs_dev-block-mmcblk0p1.img

    Close terminal emulator, then transfer to your pc.
    3
    These aren't steps but rather separate methods achieving different things. Don't bother about the first one - it notes unix permissions lost , which is why you are seeing the can't preserve ownership messages. The files still backup but correct r/w permissions do not. You may as well chuck the files really, since you managed the tarball (second instruction). Just grab this and backup to external storage, in case you ever need it.

    The raw backup will be under sdcard as you have found - stash this away somewhere safe too. You won't find mmcblk0p1 in root explorer as it is a partition, not a folder.