[Nexus 4 General] NABENDU1:
IMEI/EFS BACKUP

What is EFS/IMEI ?

Every Phone has a partition which contains data relating to your IMEI ,radio settings,data profiles etc.. This in particular is famous with Samsung devices which have the root /EFS folder and which is higly recommended to be backed up before flashing any Custom ROMs..However there is a common misconception that there is no EFS partition for the Nexus since there is no root /EFS Directory and everything is contained in dev/blocks ..

On the Nexus 4 the IMEI info is stored in the three blocks

m9kefs1 (/dev/block/mmcblk0p8)

m9kefs2 (/dev/block/mmcblk0p9)

m9kefs3 (/dev/block/mmcblk0p10)

These blocks contain all the IMEI info pertaining to your device.This data is

highly

Device specific that means each device has a different data in each block unlike the blocks for recovery,boot which are common for all . So EFS/IMEI of your device is

Unique

to your phone itself and hence it is necessary to backup your EFS.

WHY BACKUP EFS ?

1) Some points have been covered in the What section itself ( Unique to each device, important data)

2) Sometimes during a flash or even otherwise there is a bad block in your partition which corrupts a part of the EFS/IMEI partition . You are left with nothing but a dead weight you can use as a tablet without calling features or you will need to revert back to baseband version .27(This baseband seems magical since it still is able to read the corrupted data) and Android 4.2.2 .This makes it essential to backup your current partitions to flash the same if ever the same problem occurs with your device.

HOW TO BACKUP ?

FLASHABLE ZIP

Original Script from Nexus 5 thread courtesy [MENTION=2684188]autoprime[/MENTION] modified for the Nexus 4

*Download Nexus_4_Backup_EFS.zip to your SD Card from Links below!!

*

*Flash the same with TWRP/CWM no wipes needed-reboot

*

*This will create a flashable zip (efsbackupflashable.zip) in /sdcard/EFS_Backup/ ...

*

*If you can't find it under /sdcard/EFS_Backup/... try /data/media/EFS_Backup/ instead. (Thanks [MENTION=5494658]pincher65[/MENTION] )

*

*Also the EFS_Backup will contain the raw images of the 3 blocks (m9kefs1.img,m9kefs2.img,m9kefs3.img)

*

*Note each of the 3 .imgs will be exactly of 780 kb each

*

*Save this folder to your PC/Email/Drive for safety purpose

DOWNLOAD LINKS FOR BACKUP

EXT4 Version ( If you dont know what F2FS is you are on ext4 )

Link https://drive.google.com/file/d/0ByrfJAT1lgDFNnI5TUxPX0dHOHc/edit?usp=sharing

Mirror https://mega.co.nz/#!d98hyaqS!VXiuQJv5KABx-q1qqezQXqNDYiQ8liejt3pyZVOl3co

F2FS Version (Only for devices with /system formatted as F2FS)

Link https://drive.google.com/file/d/0ByrfJAT1lgDFbGY0RDNOQ1R2OHM/edit?usp=sharing

Mirror https://mega.co.nz/#!dgc0AZDT!Jv0LrcA-zOxzTTMfbAL8rHI5EYU_f21jSSiC3cJRU2E

Restoring EFS

***NOTE***

DO NOT USE YOUR BACKUP ON ANY OTHER NEXUS 4

***/NOTE***

To restore your original EFS just boot into recovery and flash the efsbackupflashable.zip in your /sdcard/EFS_Backup folder.

If flashable zip wasn't created or to manually restore efs img files run the following commands using adb shell while in recovery

If saved in /sdcard/EFS_Backup

dd if=/sdcard/EFS_Backup/m9kefs1.img of=/dev/block/mmcblk0p8
dd if=/sdcard/EFS_Backup/m9kefs2.img of=/dev/block/mmcblk0p9
dd if=/sdcard/EFS_Backup/m9kefs3.img of=/dev/block/mmcblk0p10

If saved in /data/media/EFS_Backup/

dd if=/data/media/EFS_Backup/m9kefs1.img of=/dev/block/mmcblk0p8
dd if=/data/media/EFS_Backup/m9kefs2.img of=/dev/block/mmcblk0p9
dd if=/data/media/EFS_Backup/m9kefs3.img of=/dev/block/mmcblk0p10

CREDITS

[MENTION=2684188]autoprime[/MENTION] : For his script and N5 thread
[MENTION=4851200]Rohit02[/MENTION] : For testing the Zip on F2FS and his amazing WA Grp :p

HIT THE THANKS BUTTON IF YOU LIKE MY WORK