Project

General

Profile

Actions

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 don't need to backup something that doesn't exist, so you can ignore these instructions.

This can be the case for devices without a modem like the WiFi versions of the tablets supported by Replicant, or for future devices that aren't supported yet at the time of writing.

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 backup.

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

Reboot into the recovery

To reboot in the recovery, you can follow the instructions in the RebootIntoTheRecovery wiki page.

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.

Copy and pasting commands

The next sections will have commands that you can copy and paste. To ensure that they work correctly it's best to:
  • Type them in the same terminal window
  • Copy/paste one line at the same time. For instance if you copy 10 lines and just paste then, in some cases you could have some issues.

Also to make sure that they are really executed, you can press the 'enter' key after having pasted them.

Pressing 'enter' twice will not hurt as the command will still be executed only once.

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):

You can do this with the following commands:

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 (GT-I9100), Galaxy S III (GT-I9300), Galaxy S III 4G (GT-I9305), Galaxy Note (GT-N7000), or Galaxy Note II (GT-N7100), Galaxy Note 8.0 GSM (GT-GT-N5100)

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 (GT-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 (GT-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.

You can reboot by running the following command on your computer:

adb reboot

Or alternatively you can use the Replicant recovery graphical user interface to reboot by selecting Reboot system now.

Revoke USB debugging permissions

If you don't need USB debugging permissions anymore, it might be a good idea to remove them. The Revoking all computer's USB debugging permissions section in the ADB wiki page explains how to do that.

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 backups are done.

Updated by Denis 'GNUtoo' Carikli almost 4 years ago · 37 revisions

Also available in: PDF HTML TXT