How to backup the EFS

Introduction

Many devices supported by Replicant have a partition with the modem data (IMEI, etc) which is called EFS.

It's a good idea to do a backup of this partition, to make it easier to restore it if it becomes corrupted, as it can sometimes happen with Replicant.

Only the following devices that are supported by Replicant have a modem data partition (EFS):

If you have a device that is not mentioned in the list above, it most probably doesn't have a modem data partition, so you don't need to make a backup.

Instructions

First make sure that you have adb setup correctly and that it gives you a root shell on the device by following the wiki page that explains how to install adb and get a root shell on your device.

Once this is done you can then backup the EFS.

For the Galaxy SIII (I9300), run the following commands to do that:

mkdir backup_efs
cd backup_efs
adb pull /efs/ efs
adb shell "cat /dev/block/platform/*/by-name/EFS" > EFS.img 

For the Galaxy Nexus (I9250), run the following commands to do that:

mkdir backup_efs
cd backup_efs
adb pull /factory/ factory
adb shell "cat /dev/block/platform/*/*/by-name/efs" > efs.img 

This will create a copy of the contents of /efs in the backup_efs directory. It will also backup the full partition.
Keep these files around as a backup in case anything goes wrong.