BackupTheEFS » History » Version 19
Denis 'GNUtoo' Carikli, 10/20/2019 10:25 PM
1 | 1 | Denis 'GNUtoo' Carikli | h1. How to backup the EFS |
---|---|---|---|
2 | |||
3 | Many devices supported by Replicant have a partition with the modem data (IMEI, etc) which is called EFS. |
||
4 | |||
5 | 14 | Mark Matney | 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. |
6 | 1 | Denis 'GNUtoo' Carikli | |
7 | 14 | Mark Matney | 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. |
8 | |||
9 | {{TOC}} |
||
10 | |||
11 | h2. Prerequisites |
||
12 | |||
13 | h3. Ensure that your device has a modem data partition |
||
14 | |||
15 | 1 | Denis 'GNUtoo' Carikli | Only the following devices that are supported by Replicant have a modem data partition (EFS): |
16 | 13 | Mark Matney | * [[GalaxyS2I9100|Galaxy S 2 (I9100)]] |
17 | * [[GalaxyS3I9300|Galaxy S 3 (I9300)]] |
||
18 | * [[GalaxyS3I9305|Galaxy S 3 4G (I9305)]] |
||
19 | * [[GalaxyNexusI9250|Galaxy Nexus (I9250)]] |
||
20 | * [[GalaxyNoteN7000|Galaxy Note (N7000)]] |
||
21 | 1 | Denis 'GNUtoo' Carikli | * [[GalaxyNote2N7100|Galaxy Note 2 (N7100)]] |
22 | * [[GalaxyTab270P31xx|Galaxy Tab 2 7.0 (P3100)]] |
||
23 | * [[GalaxyTab2101P51xx|Galaxy Tab 2 10.1 (P5100)]] |
||
24 | * [[GalaxyNote80N51xx|Galaxy Note 8.0 (N5100)]] |
||
25 | |||
26 | 14 | Mark Matney | 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. |
27 | 1 | Denis 'GNUtoo' Carikli | |
28 | 14 | Mark Matney | h2. Setup ADB |
29 | 1 | Denis 'GNUtoo' Carikli | |
30 | 14 | Mark Matney | Follow the instructions for [[ADB|setting up ADB on your computer]] so that you can access a root shell on your device. |
31 | 1 | Denis 'GNUtoo' Carikli | |
32 | 17 | Mark Matney | *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. |
33 | 1 | Denis 'GNUtoo' Carikli | |
34 | 14 | Mark Matney | *NOTE*: for security reasons, you may want to [[BackupTheEFS#Revoke-USB-debugging-permissions|revoke these non-expiring perissions]] once the EFS backup is complete. |
35 | 1 | Denis 'GNUtoo' Carikli | |
36 | 14 | Mark Matney | h2. Reboot into the recovery |
37 | 1 | Denis 'GNUtoo' Carikli | |
38 | 14 | Mark Matney | You can reboot your device into the recovery by one of the following methods: |
39 | 1 | Denis 'GNUtoo' Carikli | |
40 | 14 | Mark Matney | h3. Using ADB |
41 | 1 | Denis 'GNUtoo' Carikli | |
42 | 14 | Mark Matney | Run the following on your computer: |
43 | 1 | Denis 'GNUtoo' Carikli | |
44 | 14 | Mark Matney | <pre> |
45 | adb reboot recovery |
||
46 | </pre> |
||
47 | 1 | Denis 'GNUtoo' Carikli | |
48 | 14 | Mark Matney | h3. Using your Replicant device's user interface |
49 | 1 | Denis 'GNUtoo' Carikli | |
50 | 14 | Mark Matney | Do the following: |
51 | 1 | Denis 'GNUtoo' Carikli | |
52 | 14 | Mark Matney | # Make sure that your device is booted under Replicant. |
53 | # Press the power button until a menu appears. |
||
54 | 16 | Mark Matney | # Press *Reboot*. |
55 | # Select *Recovery* and then press *ok*. |
||
56 | 3 | Denis 'GNUtoo' Carikli | |
57 | 14 | Mark Matney | h2. Ensure that your device's system partition is mounted |
58 | 3 | Denis 'GNUtoo' Carikli | |
59 | 14 | Mark Matney | In order to get a root shell in the recovery, your devices system partition must be mounted. |
60 | 3 | Denis 'GNUtoo' Carikli | |
61 | 14 | Mark Matney | 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. |
62 | 1 | Denis 'GNUtoo' Carikli | |
63 | 14 | Mark Matney | In any case, it's still best to do the following to make sure that the system partition is mounted: |
64 | |||
65 | 16 | Mark Matney | # Select *Advanced*. |
66 | # Select *Mount /system*. |
||
67 | 14 | Mark Matney | # Press the back key to get back to the general menu. |
68 | |||
69 | h2. Backup the modem data partition |
||
70 | |||
71 | 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): |
||
72 | |||
73 | 1 | Denis 'GNUtoo' Carikli | <pre> |
74 | 14 | Mark Matney | REPLICANT_EFS_BACKUP_DIR=~/replicant_devices/0123456789abcdef/backup_efs |
75 | mkdir -p $REPLICANT_EFS_BACKUP_DIR && cd $REPLICANT_EFS_BACKUP_DIR |
||
76 | </pre> |
||
77 | |||
78 | The remaining steps you must take depends on which device you have. |
||
79 | |||
80 | h3. Galaxy S 2 (I9100), Galaxy S 3 (I9300), Galaxy S 3 4G (I9305), Galaxy Note (N7000), or Galaxy Note 2 (N7100) |
||
81 | |||
82 | While inside the backup directory you just created, run the following commands: |
||
83 | |||
84 | <pre> |
||
85 | 1 | Denis 'GNUtoo' Carikli | adb shell "mkdir /efs" |
86 | adb shell "mount /dev/block/platform/*/by-name/EFS /efs" |
||
87 | adb pull /efs/ efs |
||
88 | adb shell "umount /efs" |
||
89 | 15 | Mark Matney | adb shell "rmdir /efs" |
90 | 18 | Denis 'GNUtoo' Carikli | adb shell "cat /dev/block/platform/*/by-name/EFS > /EFS.img" |
91 | adb pull /EFS.img ./ |
||
92 | 1 | Denis 'GNUtoo' Carikli | </pre> |
93 | |||
94 | 14 | Mark Matney | h3. Galaxy Nexus (I9250) |
95 | |||
96 | While inside the backup directory you just created, run the following commands: |
||
97 | |||
98 | 1 | Denis 'GNUtoo' Carikli | <pre> |
99 | adb shell "mkdir /efs" |
||
100 | adb shell "mount /dev/block/platform/*/*/by-name/efs /efs" |
||
101 | adb pull /efs/ efs |
||
102 | adb shell "umount /efs" |
||
103 | adb shell "rmdir /efs" |
||
104 | 18 | Denis 'GNUtoo' Carikli | adb shell "cat /dev/block/platform/*/*/by-name/efs > /efs.img" |
105 | adb pull /efs.img ./ |
||
106 | 1 | Denis 'GNUtoo' Carikli | </pre> |
107 | |||
108 | 14 | Mark Matney | h3. Galaxy Tab 2 7.0 (P3100) |
109 | |||
110 | While inside the backup directory you just created, run the following commands: |
||
111 | |||
112 | 1 | Denis 'GNUtoo' Carikli | <pre> |
113 | adb shell "mkdir /efs" |
||
114 | 11 | Denis 'GNUtoo' Carikli | adb shell "mount /dev/block/platform/*/*/by-name/EFS /efs" |
115 | 1 | Denis 'GNUtoo' Carikli | adb pull /efs/ efs |
116 | adb shell "umount /efs" |
||
117 | adb shell "rmdir /efs" |
||
118 | 18 | Denis 'GNUtoo' Carikli | adb shell "cat /dev/block/platform/*/*/by-name/EFS > /EFS.img" |
119 | adb pull /EFS.img ./ |
||
120 | 11 | Denis 'GNUtoo' Carikli | </pre> |
121 | |||
122 | 14 | Mark Matney | This will create a copy of the contents of /efs in the backup directory. It will also backup the full partition. |
123 | 11 | Denis 'GNUtoo' Carikli | Keep these files around as a backup in case anything goes wrong. |
124 | |||
125 | 14 | Mark Matney | *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. |
126 | 11 | Denis 'GNUtoo' Carikli | |
127 | 14 | Mark Matney | h2. Reboot your device |
128 | 1 | Denis 'GNUtoo' Carikli | |
129 | 14 | Mark Matney | Once the backup is done, you can reboot your device into Replicant by one of two ways: |
130 | |||
131 | h3. Using ADB |
||
132 | |||
133 | Run the following on your computer: |
||
134 | |||
135 | <pre> |
||
136 | adb reboot |
||
137 | </pre> |
||
138 | |||
139 | h3. Using the Replicant recovery user interface |
||
140 | |||
141 | 16 | Mark Matney | Select *Reboot system now*. |
142 | 14 | Mark Matney | |
143 | h2. Revoke USB debugging permissions |
||
144 | |||
145 | 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*. |
||
146 | |||
147 | That's it! Your device's EFS partition is now backed up. Your device should be running Replicant normally again. |
||
148 | 19 | Denis 'GNUtoo' Carikli | |
149 | h1. See also |
||
150 | |||
151 | * 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. |