BackupsResearch » History » Version 25
dl lud, 06/24/2024 06:12 PM
Update link to SeedVault.
1 | 1 | Denis 'GNUtoo' Carikli | h1. BackupsResearch |
---|---|---|---|
2 | |||
3 | {{>toc}} |
||
4 | |||
5 | 8 | Denis 'GNUtoo' Carikli | h2. Introduction |
6 | |||
7 | The [[BackupTheEFS]] page has instructions to backup the EFS. This page instead tries to document why it is done in that way, and what are the advantages and disadvantages of various other backups methods. |
||
8 | |||
9 | 9 | Denis 'GNUtoo' Carikli | This can also be useful to write more generic backup instructions to do a more complete backup. |
10 | |||
11 | 1 | Denis 'GNUtoo' Carikli | h2. Doing the backup of partitions or other block devices |
12 | |||
13 | h3. adb shell cat pipe |
||
14 | |||
15 | 17 | Denis 'GNUtoo' Carikli | Old versions of the "EFS backup instructions":https://redmine.replicant.us/projects/replicant/wiki/BackupTheEFS/17 (up to revision 17) used the following command: |
16 | 1 | Denis 'GNUtoo' Carikli | <pre> |
17 | 17 | Denis 'GNUtoo' Carikli | adb shell "cat /dev/block/platform/*/by-name/EFS" > EFS.img |
18 | 1 | Denis 'GNUtoo' Carikli | </pre> |
19 | |||
20 | At some point or under some condition, this stopped working and the backup were corrupted. |
||
21 | 2 | Denis 'GNUtoo' Carikli | |
22 | h3. adb shell cat adb pull |
||
23 | |||
24 | 14 | Denis 'GNUtoo' Carikli | With something like that: |
25 | 1 | Denis 'GNUtoo' Carikli | <pre> |
26 | 14 | Denis 'GNUtoo' Carikli | adb shell "cat /dev/block/platform/*/by-name/EFS > /EFS.img" |
27 | 2 | Denis 'GNUtoo' Carikli | adb pull /EFS.img ./ |
28 | 20 | Denis 'GNUtoo' Carikli | </pre> |
29 | 2 | Denis 'GNUtoo' Carikli | |
30 | 18 | Denis 'GNUtoo' Carikli | h4. Two steps |
31 | |||
32 | Doing it in two stages like that seem to be widely used in other instructions (like the ones found in XDA forums). |
||
33 | |||
34 | The advantage is that the '*' enables to use the same command across many more devices. |
||
35 | |||
36 | And we need two steps because the '*' is not interpreted by a shell when using adb pull: |
||
37 | <pre> |
||
38 | $ adb pull /dev/block/platform/*/by-name/EFS |
||
39 | adb: error: remote object '/dev/block/platform/*/by-name/EFS' does not exist |
||
40 | $ adb pull "/dev/block/platform/*/by-name/EFS" |
||
41 | adb: error: remote object '/dev/block/platform/*/by-name/EFS' does not exist |
||
42 | $ adb pull '/dev/block/platform/*/by-name/EFS' |
||
43 | adb: error: remote object '/dev/block/platform/*/by-name/EFS' does not exist |
||
44 | 1 | Denis 'GNUtoo' Carikli | </pre> |
45 | 20 | Denis 'GNUtoo' Carikli | |
46 | 21 | Denis 'GNUtoo' Carikli | See the part on [[BackupsResearch#adb-pull-the-block-device|adb-pull-the-block-device]] for more details on how to workaround the lack of expansion and have only 1 command to do the job. |
47 | 18 | Denis 'GNUtoo' Carikli | |
48 | This method requires the partition to be small enough. Otherwise it will create several issues: |
||
49 | * If the partition is bigger than the RAM, the resulting file in / will end up exhausting all the ram, and the backup will fail. |
||
50 | * It instead the partition is big but still fits, doing that would not be very efficient as you would copy the partition once on / to then copy it again through adb. |
||
51 | |||
52 | h4. dd |
||
53 | 2 | Denis 'GNUtoo' Carikli | |
54 | Normally cat should produce a valid backup, however it might be better to use dd for extra safety. |
||
55 | |||
56 | 10 | Denis 'GNUtoo' Carikli | On Replicant 6.0 0004, at least the recoveries for the following devices have 'dd': |
57 | 19 | Denis 'GNUtoo' Carikli | * Galaxy SII (GT-I9100) |
58 | * Galaxy Nexus (GT-I9250) |
||
59 | * Galaxy SIII (GT-I9300) |
||
60 | |||
61 | 2 | Denis 'GNUtoo' Carikli | h3. adb pull the block device |
62 | |||
63 | The following should also work: |
||
64 | <pre> |
||
65 | adb pull /dev/block/mmcblk0p3 ./EFS.img |
||
66 | </pre> |
||
67 | 3 | Denis 'GNUtoo' Carikli | |
68 | 1 | Denis 'GNUtoo' Carikli | The advantage is that it can also backup huge partitions like the user data partition or Replicant system partition. |
69 | |||
70 | 22 | Denis 'GNUtoo' Carikli | You cannot do @adb pull /dev/block/platform/*/by-name/EFS@ as the expansion of @*@ will fail. |
71 | |||
72 | There are possible workarounds: |
||
73 | 16 | doak complex | <pre> |
74 | part="`adb shell "ls /dev/block/platform/*/by-name/EFS" | head --bytes=-2`" |
||
75 | adb pull "$part" ./EFS.img |
||
76 | </pre> |
||
77 | Be aware of the @head --bytes=-2@ which is needed to get rid of the nasty @0x0d 0x0a@ line ending returned by @adb@. |
||
78 | (Tested on Recovery of Replicant 6.0 0003.) |
||
79 | 5 | Kurtis Hanna | |
80 | 23 | Denis 'GNUtoo' Carikli | h2. Symlinks and adb push |
81 | |||
82 | @adb push@ doesn't handle symlinks properly. For instance, with a Galaxy SIII (GT-I9300) with a Replicant 6 recovery, if we use: |
||
83 | <pre> |
||
84 | adb pull /dev/block/platform/dw_mmc/by-name/USERDATA ./USERDATA.img |
||
85 | </pre> |
||
86 | we get the following failure: |
||
87 | <pre> |
||
88 | adb: error: failed to copy 'USERDATA.img' to '/dev/block/platform/dw_mmc/by-name/USERDATA': remote No space left on device |
||
89 | USERDATA.img: 0 files pushed. 4.3 MB/s (436154368 bytes in 96.842s) |
||
90 | </pre> |
||
91 | |||
92 | 24 | Denis 'GNUtoo' Carikli | So here no data has been being written on the data partition and it exhausted the ramdisk of the recovery. |
93 | |||
94 | This is because instead of writing to that partition, it deleted the @/dev/block/platform/dw_mmc/by-name/USERDATA@ symlink and recreated a file at the same path (@/dev/block/platform/dw_mmc/by-name/USERDATA@) with the data from USERDATA.img. |
||
95 | 23 | Denis 'GNUtoo' Carikli | |
96 | 25 | dl lud | h2. Backup applications |
97 | 11 | Denis 'GNUtoo' Carikli | |
98 | It might be a good idea to have a list of backup applications and/or to ship one with Replicant. |
||
99 | 1 | Denis 'GNUtoo' Carikli | |
100 | 25 | dl lud | As of 2024, many after market distributions are using "SeedVault":https://calyxinstitute.org/projects/seedvault-encrypted-backup-for-android. It seems a good candidate to ship by default on Replicant. |
101 | 5 | Kurtis Hanna | |
102 | 25 | dl lud | F-Droid also has other applications. As F-Droid packages are not all FSDG compliant, we would need to make sure that the backup application we recommend or ship are FSDG compliant. |
103 | |||
104 | It may also be a good idea to understand if the backup solution chosen is sustainable in the long term. If development stops or upstream decides to make the new version proprietary some users might have a hard time adapting to new backup applications or systems. |