h1. 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":https://redmine.replicant.us/issues/1869. The actual backup process is run while the [[RecoveryImage|Replicant recovery]] is booted (rather than Replicant itself) to ensure that the modem data partition is not modified during the backup. {{TOC}} h2. Prerequisites h3. Ensure that your device has a modem data partition Only the following devices that are supported by Replicant have a modem data partition (EFS): * [[GalaxyS2I9100|Galaxy S 2 (I9100)]] * [[GalaxyS3I9300|Galaxy S 3 (I9300)]] * [[GalaxyS3I9305|Galaxy S 3 4G (I9305)]] * [[GalaxyNexusI9250|Galaxy Nexus (I9250)]] * [[GalaxyNoteN7000|Galaxy Note (N7000)]] * [[GalaxyNote2N7100|Galaxy Note 2 (N7100)]] * [[GalaxyTab270P31xx|Galaxy Tab 2 7.0 (P3100)]] * [[GalaxyTab2101P51xx|Galaxy Tab 2 10.1 (P5100)]] * [[GalaxyNote80N51xx|Galaxy Note 8.0 (N5100)]] 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. h2. Setup ADB Follow the instructions for [[ADB|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 [[BackupTheEFS#Revoke-USB-debugging-permissions|revoke these non-expiring perissions]] once the EFS backup is complete. h2. Reboot into the recovery You can reboot your device into the recovery by one of the following methods: h3. Using ADB Run the following on your computer:
adb reboot recovery
h3. Using your Replicant device's user interface Do the following: # Make sure that your device is booted under Replicant. # Press the power button until a menu appears. # Press "Reboot". # Select "Recovery" and then press "ok". h2. 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":https://redmine.replicant.us/issues/1934, 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: # Select Advanced. # Select "Mount /system". # Press the back key to get back to the general menu. h2. 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. h3. 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 "cat /dev/block/platform/*/by-name/EFS" > EFS.img 
h3. 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 "cat /dev/block/platform/*/*/by-name/efs" > efs.img 
h3. 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 "cat /dev/block/platform/*/*/by-name/EFS" > 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":https://lists.osuosl.org/mailman/listinfo/replicant so we could add instructions for your device. h2. Reboot your device Once the backup is done, you can reboot your device into Replicant by one of two ways: h3. Using ADB Run the following on your computer:
adb reboot
h3. Using the Replicant recovery user interface Select "Reboot system now". h2. 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.