Project

General

Profile

Actions

BackupTheEFS » History » Revision 19

« Previous | Revision 19/37 (diff) | Next »
Denis 'GNUtoo' Carikli, 10/20/2019 10:25 PM


How to backup the EFS

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 so that you can restore it if it becomes corrupted, which can sometimes happen with Replicant.

The actual backup process is run while the Replicant recovery is booted (rather than Replicant itself) to ensure that the modem data partition is not modified during the backup.

Prerequisites

Ensure that your device has a modem data partition

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

If your device is not listed above, it probably doesn't have a modem data partition. In that case, you can skip the rest of these instructions.

Setup ADB

Follow the instructions for setting up ADB on your computer so that you can access a root shell on your device.

NOTE: when prompted on your Replicant device, make sure that you check the box that says Always allow from this computer when you grant your computer USB debugging permissions. Otherwise, you will be unable to obtain root shell access on your Replicant device when you reboot it into the recovery OS to actually perform the EFS backup.

NOTE: for security reasons, you may want to revoke these non-expiring perissions once the EFS backup is complete.

Reboot into the recovery

You can reboot your device into the recovery by one of the following methods:

Using ADB

Run the following on your computer:

adb reboot recovery

Using your Replicant device's user interface

Do the following:

  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.

Ensure that your device's system partition is mounted

In order to get a root shell in the recovery, your devices system partition must be mounted.

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 do the following to make sure that the system partition is mounted:

  1. Select Advanced.
  2. Select Mount /system.
  3. Press the back key to get back to the general menu.

Backup the modem data partition

First, create a directory on your computer where you will store the backup data. One way to keep this data organized is with a directory for each device named with its serial number (useful if you have more than one Replicant device):

REPLICANT_EFS_BACKUP_DIR=~/replicant_devices/0123456789abcdef/backup_efs
mkdir -p $REPLICANT_EFS_BACKUP_DIR && cd $REPLICANT_EFS_BACKUP_DIR

The remaining steps you must take depends on which device you have.

Galaxy S 2 (I9100), Galaxy S 3 (I9300), Galaxy S 3 4G (I9305), Galaxy Note (N7000), or Galaxy Note 2 (N7100)

While inside the backup directory you just created, run the following commands:

adb shell "mkdir /efs" 
adb shell "mount /dev/block/platform/*/by-name/EFS /efs" 
adb pull /efs/ efs
adb shell "umount /efs" 
adb shell "rmdir /efs" 
adb shell "cat /dev/block/platform/*/by-name/EFS > /EFS.img" 
adb pull /EFS.img ./

Galaxy Nexus (I9250)

While inside the backup directory you just created, run the following commands:

adb shell "mkdir /efs" 
adb shell "mount /dev/block/platform/*/*/by-name/efs /efs" 
adb pull /efs/ efs
adb shell "umount /efs" 
adb shell "rmdir /efs" 
adb shell "cat /dev/block/platform/*/*/by-name/efs > /efs.img" 
adb pull /efs.img ./

Galaxy Tab 2 7.0 (P3100)

While inside the backup directory you just created, run the following commands:

adb shell "mkdir /efs" 
adb shell "mount /dev/block/platform/*/*/by-name/EFS /efs" 
adb pull /efs/ efs
adb shell "umount /efs" 
adb shell "rmdir /efs" 
adb shell "cat /dev/block/platform/*/*/by-name/EFS > /EFS.img" 
adb pull /EFS.img ./

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

NOTE: 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 your device

Once the backup is done, you can reboot your device into Replicant by one of two ways:

Using ADB

Run the following on your computer:

adb reboot

Using the Replicant recovery user interface

Select Reboot system now.

Revoke USB debugging permissions

If you are concerned about security, you may want to revoke the non-expiring USB debugging permissions that you granted to your computer earlier (which you may of course grant again at any time, as desired). This control is located at Settings > Developer options > Revoke USB debugging authorizations.

That's it! Your device's EFS partition is now backed up. Your device should be running Replicant normally again.

See also

  • The BackupsResearch page has information on why the backup is done this way. It might also be useful to read and contribute to it if you intend to change the way the EFS backups are done.

Updated by Denis 'GNUtoo' Carikli over 4 years ago · 19 revisions

Also available in: PDF HTML TXT