Efs Img I9300

A script that attempts to extract nv_data.bin files from an EFSv2partition image.The discussion below is applicable to the Samsung i9300 intl. GSM.However, it may be relevant to other devices as well.

The backup will be saved in the internal storage as 'efs.img' and 'efs.tar.gz' KTool work only on Samsung galaxy S2/Note/Nexus/S3 (International I9300 -.NOT. US variants) NEVER RESTORE IF YOU ALREADY DIDN'T LOST THE IMEI I am not responsible if something bad happened to your device (use this AT YOUR OWN RISK) Downloads.

The script should work in the following cases

  • You have accidentally formatted your EFS partition incorrectly, but haven't writtenanything to it (for example, when it's been formatted throughSwapper for Root and thus corrupted.
  • You have a corrupted the EFS partition through some other means
  • Possibly, when the phone is stuck during boot, despite having flashed the stock rom

Corrupted EFS partition

You know that the EFS partition has been corrupted when,

  • You are stuck and cannot boot (mine was stuck at the bootloader Samsung i9300 image when I had CyanogenMod installed)
  • If you're on stock, you are stuck at the Samsung logo with a flashing blue indicator light
  • and you should see the following error when you boot into the stock Samsung recovery:

E:failed to mount /efs (Invalid argument)

The script will not be of any help, since the device has already restoredits default EFS files.

I have only tested the tool on Samsung i9300 intl. (S3), GSMwith EFSv2. It may or may not work with EFSv1.

  • Ubuntu / Debian / other *nix operating system
  • Python 2.7
  1. Install a custom recovery, I used CWM (You can skip this step if you have already done so)
  2. Make a full efs backup from a terminal emulator (I used AROMA, to get a terminal emulator)

dd if=/dev/block/mmcblk0p3 of=/storage/sdcard1/efs_broken.img

Efs Img I9300
  1. Format your EFS partition using a terminal emulator from recovery (Again, I used AROMA)

mke2fs /dev/block/mmcblk0p3

Software Update Distribution failed: CreateDistributionPolicy: Unable to initialize policy 'MS17-005' for provided advertisement set. Please see log for details.CreateDistributionPolicy: Unable to initialize policy 'MS17-005' for provided advertisement set. Patch msi

  1. Restart the phone, you should now be able to boot into your phone.Wait till you reach the homescreen then continue with the instructions.
  2. Boot back into recovery, then backup your EFS partion again.This backup provides us with a working default which we shall use later.

dd if=/dev/block/mmcblk0p3 of=/storage/sdcard1/efs_default.img

  1. Copy over the EFS dumps to your computer
  2. Next, execute the following on your computer

sudo python efs_recover.py efs_broken.img -g efs_default.img

  1. If the execution was successful you should see recovered_efs_X.img files have beengenerated. Where X is the number of the image.
  2. Place the recovered_efs_x.img files on your sdcard
  3. Reboot your phone into recovery and enter the terminal emulator (AROMA). Decide on a recovered image touse. Replace X with the number you choose

dd if=/storage/sdcard1/recovered_efs_X.img of=/dev/block/mmcblk0p3

  1. Reboot your phone, go into About and see if your IMEI was restored, if not, repeat steps 10 and 11 with adifferent image.

To see help for the script, execute

python efs_recover.py -h

I drew from the knowledge and effort of others in this project. The major contribution was an XDA forumthread by SlashVSuccessful IMEI repair on i9300 without backup.