[HOW TO] /efs Folder backup + Restore NV_DATA.BIN
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
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.
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.
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:
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:
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:
busybox chown 1001:1001 /efs/nv_data.bin or
chown 1001:1001 /efs/nv_data.bin
Hope this can help anyone with doubts. Cheers!