Project

General

Profile

BackupTheEFS » History » Version 22

Denis 'GNUtoo' Carikli, 07/03/2020 01:11 AM
fix supported devices text

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