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.
This can also be useful to write more generic backup instructions to do a more complete backup.
Old versions of the EFS backup instructions (up to revision 17) used the following command:
adb shell "cat /dev/block/platform/*/by-name/EFS" > EFS.img
At some point or under some condition, this stopped working and the backup were corrupted.
With something like that:
adb shell "cat /dev/block/platform/*/by-name/EFS > /EFS.img" adb pull /EFS.img ./
Doing it in two stages like that seem to be widely used in other instructions (like the ones found in XDA forums).
The advantage is that the '*' enables to use the same command across many more devices.
And we need two steps because the '*' is not interpreted by a shell when using adb pull:
$ adb pull /dev/block/platform/*/by-name/EFS adb: error: remote object '/dev/block/platform/*/by-name/EFS' does not exist $ adb pull "/dev/block/platform/*/by-name/EFS" adb: error: remote object '/dev/block/platform/*/by-name/EFS' does not exist $ adb pull '/dev/block/platform/*/by-name/EFS' adb: error: remote object '/dev/block/platform/*/by-name/EFS' does not exist
See the part on 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.
This method requires the partition to be small enough. Otherwise it will create several issues:Normally cat should produce a valid backup, however it might be better to use dd for extra safety.
On Replicant 6.0 0004, at least the recoveries for the following devices have 'dd':The following should also work:
adb pull /dev/block/mmcblk0p3 ./EFS.img
The advantage is that it can also backup huge partitions like the user data partition or Replicant system partition.
TODO:*
fails), but this would do:part="`adb shell "ls /dev/block/platform/*/by-name/EFS" | head --bytes=-2`" adb pull "$part" ./EFS.img
head --bytes=-2
which is needed to get rid of the nasty 0x0d 0x0a
line ending returned by adb
.It might be a good idea to have a list of backup applications and/or to ship one with Replicant.
It might also be a good idea to understand if the backup solution chosen is sustainable in the long term: If the development stop or upstream decide to make the new version proprietary some users might have a hard time adapting to new backup applications or systems.