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
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 ?
Original Script from Nexus 5 thread courtesy @autoprime 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 @pincher65 )
*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 )
F2FS Version (Only for devices with /system formatted as F2FS)
***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
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