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

We will backup the modem partition from the Replicant recovery.

This is to make sure that the modem data partition is not being modified when we are doing the backup.

Enable root access through adb in Replicant

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.

This will enable you to also be able to get a root shell in the recovery.

Reboot in the recovery

Once this is done you need to reboot in the Replicant recovery.

This is to make sure that the modem data partition is not being modified when we are doing the backup.

To do that:
1. Make sure that your device is booted under Replicant.
2. Press the power button until a menu appears
3. Press "Reboot"
4. Select "Recovery" and then press "ok"
5. The device will then reboot to the Replicant recovery

Enable root access through adb in the recovery

In order to get a root shell in the recovery you need to do the following:
1. Select Advanced
2. Select "Mount /system"
3. Press the back key to get back to the general menu

Note that on certain devices, the system partition is already mounted so you might already be able to get a root shell without mounting the system partition again.

In any case it's still best to follow the instructions above to make sure that the system partition is mounted on your device.

Backup the modem data partition on your computer

For the Galaxy S 2 (I9100), the Galaxy SIII (I9300), the Galaxy SIII 4G (I9305), the Galaxy Note (N7000), or the Galaxy Note 2 (N7100), run the following commands to do that:

mkdir backup_efs
cd backup_efs
adb shell "mkdir /efs" 
adb shell "mount /dev/block/platform/*/by-name/EFS /efs" 
adb pull /efs/ efs
adb shell "umount /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 shell "mkdir /efs" 
adb shell "mount /dev/block/platform/*/*/by-name/efs /efs" 
adb pull /efs/ efs
adb shell "umount /efs" 
adb shell "cat /dev/block/platform/*/*/by-name/efs" > efs.img 

For the Galaxy Tab 2 7.0 (P3100), run the following commands to do that:

mkdir backup_efs
cd backup_efs
adb shell "mkdir /efs" 
adb shell "mount /dev/block/platform/*/*/by-name/EFS /efs" 
adb pull /efs/ efs
adb shell "umount /efs" 
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.

If your device has an EFS and is not mentioned in the instructions above, please contact us through the mailing list so we could add instructions for your device.

Reboot in Replicant

Once the backup is done, you can then reboot in Replicant. To do that:
1. Select "Reboot system now"
2. Your device will then reboot in Replicant.