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.
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.
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.
To reboot in the recovery, you can follow the instructions in the RebootIntoTheRecovery wiki page.
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:
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.
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.
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 ./
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 ./
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.
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.
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.