Post Reply

[HOW TO] /efs Folder backup + Restore NV_DATA.BIN

OP Candanga

3rd December 2010, 06:32 PM   |  #1  
Candanga's Avatar
OP Senior Member
Flag Pocri
Thanks Meter: 106
 
177 posts
Join Date:Joined: May 2007
More
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 (my case).

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 centers.

***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***

Please don’t ask how to recover your IMEI if you have previously messed your SGS without backing up this folder. I’m not familiar with such methods plus it is UNRELATED to this thread.

What you will need:
  • Rooted SGS 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)
  • Terminal Emulator by Jack Palevich (available from the market) <-Terminal Emulator or use ADB which is included in the SDK Development Tools

IMPORTANT: If getting "error: device not found" under ADB (happened to me under CM7 2.3.4), you need to update your ADB drivers. Go HERE and follow the instructions to download the USB Driver for Windows, Revision 4 (Nexus S Support). Then update the drivers under your Windows Device Manager.
--------------------------------------
Backup commands
--------------------------------------

Depending on the type of root, you might have to use “busybox” at the beginning of the sting or just the string:

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 during this process, because it will request SU permissions; 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. Once you are finished with the files, you need to turn it off so you can get the files.

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

busybox tar zcvf /sdcard/efs-backup.tar.gz /efs

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

In another forum I also saw a recommendation to back up the st13 under /dev/block which can support greatly to recoveryour IMEI in case of a screw-up:

Code:
su
cat /dev/block/stl3 > /sdcard/efs_dev-block-stl3.img         or

busybox cat /dev/block/stl3 > /sdcard/efs_dev-block-stl3.img
Same thing, the target is the INTERNAL SDCARD, so go ahead and copy the file.

----------------------------
nv_data.bin - Restore
----------------------------

In case you screwed your IMEI by playing with the nv_data.bin and you are experiencing issues like:
  • Fake IMEI (usually 004999010640000)
  • Unable to download apps from the market
  • Unable to unlock your SIM card using your PIN
  • Weird apps are downloading automatically from the market
  • Blinking SIM card icon on the top tray… ETC

You may want to upload your fresh copy of this file back to the phone. Use this commands:
(thanks to Methyldioxide method to recover the product code http://forum.xda-developers.com/showthread.php?t=780509 )

Copy the file from your backup (efs-backup.tar.gz) and paste it in the INTERNAL SDCARD:

Code:
cp /sdcard/nv_data.bin /efs/nv_data.bin 
rm -rf /efs/nv_data.bin.md5 OR

busybox rm -rf /efs/nv_data.bin.md5
Reboot your SGS
The md5 hash/signature is removed (rm) as the system will generate a new one.

**Most likely your SIM code won’t work after this and you won’t be able to log into the phone**
Pop off your SIM card, boot your SGS and execute the following commands to change ownership of the file under ADB or Terminal as well:

Code:
su
busybox chown 1001:1001 /efs/nv_data.bin  or

chown 1001:1001 /efs/nv_data.bin
Hope this can help anyone with doubts. Cheers!
Last edited by Candanga; 31st May 2011 at 10:57 PM.
The Following 44 Users Say Thank You to Candanga For This Useful Post: [ View ]
3rd December 2010, 10:18 PM   |  #2  
Member
Thanks Meter: 4
 
48 posts
Join Date:Joined: Nov 2010
Donate to Me
More
An alternative to the backup part is to use Root Explorer and zip the whole /efs folder onto your external sd card. (or wherever you want)
The Following 3 Users Say Thank You to Jule1k For This Useful Post: [ View ]
3rd December 2010, 10:23 PM   |  #3  
Senior Member
Thanks Meter: 272
 
5,710 posts
Join Date:Joined: Jun 2010
More
How about a method to restore the IMEI if you never had a good back up to begin with ?
3rd December 2010, 10:50 PM   |  #4  
cantIntoCode's Avatar
Retired Recognized Developer
Flag Glasgow
Thanks Meter: 2,585
 
1,599 posts
Join Date:Joined: Aug 2010
More
Quote:
Originally Posted by Candanga

Please don’t ask how to recover your IMEI if you have previously messed your SGS without backing up this folder. I’m not familiar with such methods plus it is UNRELATED to this thread.

Quote:
Originally Posted by EarlZ

How about a method to restore the IMEI if you never had a good back up to begin with ?

How did you manage to miss that?
3rd December 2010, 11:08 PM   |  #5  
pele78's Avatar
Senior Member
Flag Cambridgeshire, England
Thanks Meter: 1,930
 
4,813 posts
Join Date:Joined: Oct 2010
Donate to Me
Quote:
Originally Posted by EarlZ

How about a method to restore the IMEI if you never had a good back up to begin with ?

had the feeling you would be here LMAO..
3rd December 2010, 11:26 PM   |  #6  
Senior Member
Thanks Meter: 24
 
212 posts
Join Date:Joined: Sep 2010
funny thing

the other day i messed up nv_data.bak trying to get my old product code back

the phone would not recognise the sim card

i deleted the whole /efs folder and the phone made a new one

i got my imei but no product code

sim card started working everything looked ok appart from sgs tools reporting nothing as phone !?!

i did restore /efs from a backup i had and then my product code came back

weird though

I was on jpo when all this happened
3rd December 2010, 11:36 PM   |  #7  
Senior Member
Thanks Meter: 272
 
5,710 posts
Join Date:Joined: Jun 2010
More
Quote:
Originally Posted by pele78

had the feeling you would be here LMAO..

I guess you find it entertaining if people messed up their IMEI, well we all have our kinkiness.
4th December 2010, 03:12 AM   |  #8  
Candanga's Avatar
OP Senior Member
Flag Pocri
Thanks Meter: 106
 
177 posts
Join Date:Joined: May 2007
More
Quote:
Originally Posted by EarlZ

I guess you find it entertaining if people messed up their IMEI, well we all have our kinkiness.

@EarlZ - I myself was a victim of this, but I managed to make a duplicate of my nv_data.bin as per instructions of the guide that I was following to unlock my SGS.

The only "tip" that I can give you (geez.. Im going against my own disclaimer lol ) is to try to flash it back to JM1 or the earliest release of your mobile. I think I remember to get my IMEI back doing this, but then lost it flashing to a newer ROM. AGAIN, my "research" didn't go past this as I managed to get my IMEI back, reason why I got inspired to throw this little guide.

Hope this can get you started on your IMEI recovery journey.

Cheers mate.
9th December 2010, 12:16 PM   |  #9  
Senior Member
Thanks Meter: 15
 
455 posts
Join Date:Joined: Jan 2010
More
The restore should also be done with tar - in this way you won't lose the permissions on the files.
9th December 2010, 09:31 PM   |  #10  
Member
Flag Lisbon
Thanks Meter: 5
 
48 posts
Join Date:Joined: Jan 2007
More
Quote:
Originally Posted by ingineru

The restore should also be done with tar - in this way you won't lose the permissions on the files.

Just for future reference (in case I need it ) can you give us the full command line?

Thanks

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy S I9000 Android Development by ThreadRank