Project

General

Profile

BackupTheEFS » History » Revision 14

Revision 13 (Mark Matney, 08/15/2019 05:12 AM) → Revision 14/37 (Mark Matney, 08/15/2019 06:43 AM)

h1. How to backup the EFS 

 h1. 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 so that you can partition, to make it easier to restore it if it becomes corrupted, which "can as "it 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 you have a device that is not listed mentioned in the list above, it most probably doesn't have a modem data partition. In that case, partition, so you can skip the rest of these instructions. don't need to make a backup. 

 h2. Setup ADB Instructions 

 Follow We will backup the instructions for [[ADB|setting up ADB on your computer]] so modem partition from the [[RecoveryImage|Replicant recovery]]. 

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

 h3. Enable root access a root shell on your device. through adb in Replicant 

 *NOTE*: when prompted on your Replicant device, First make sure that you check the box have adb setup correctly and that says "Always allow from this computer" when it gives you grant your computer USB debugging permissions. Otherwise, you will be unable to obtain a root shell access on your Replicant the device when you reboot it into by following the recovery OS wiki page that explains how to actually perform the EFS backup. [[ADB|install adb and get a root shell]] on your device. 

 *NOTE*: for security reasons, This will enable you may want to [[BackupTheEFS#Revoke-USB-debugging-permissions|revoke these non-expiring perissions]] once also be able to get a root shell in the EFS backup is complete. recovery. 

 h2. h3. Reboot into in the recovery 

 You can Once this is done you need to reboot your device into in the recovery by one of the following methods: Replicant recovery. 

 h3. Using ADB 

 Run This is to make sure that the following on your computer: modem data partition is not being modified when we are doing the backup. 

 <pre> To do that: 
 adb reboot recovery 
 </pre> 

 h3. 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. appears 
 # 3. Press "Reboot". "Reboot" 
 # 4. Select "Recovery" and then press "ok". "ok" 
 5. The device will then reboot to the Replicant recovery 

 h2. Ensure that your device's system partition is mounted h3. Enable root access through adb in the recovery 

 In order to get a root shell in the recovery, your devices system partition must be mounted. 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 

 On Note that on certain devices, "the system partition is already mounted":https://redmine.replicant.us/issues/1934, 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, case it's still best to do follow the following instructions above to make sure that the system partition is mounted: mounted on your device. 

 # Select Advanced. 
 # Select "Mount /system". 
 # Press the back key to get back to the general menu. 

 h2. h3. Backup the modem data partition 

 First, create a directory on your computer where you will store 

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

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

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

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

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

 commands to do that: 
 <pre> 
 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  
 </pre> 

 h3. For the Galaxy Nexus (I9250) 

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

 commands to do that: 
 <pre> 
 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  
 </pre> 

 h3. For the Galaxy Tab 2 7.0 (P3100) 

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

 commands to do that: 
 <pre> 
 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 
 </pre> 

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

 *NOTE*: if 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. h3. Reboot your device in Replicant 

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

 h3. Using ADB 

 Run the following on your computer: 

 <pre> in Replicant. To do that: 
 adb reboot 
 </pre> 

 h3. Using the Replicant recovery user interface 

 1. 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! now" 
 2. Your device's EFS partition is now backed up. Your device should be running Replicant normally again. will then reboot in Replicant.