Dump all partitions from a custom recovery mode with test keys

Before you start reading, you are invited to deepen your knowledge of the RECOVERY MODE, how it works and how to make a custom one for your Android or KaiOS phone:

It is always important to have a complete copy of your partitions available, so that you can reinstall everything in case of deep damage to the device at the software level.

As you can see from this video, having a custom recovery with test-keys allows you to flash a zip containing scripts, like this tool, dumpall, which will get all the dumps of your phone by saving them in a new folder on the SD card called "dumps".

If you prefer to run a test from the command line it may take longer, even stopping the main boot daemon on KaiOS (adb shell stop b2g). Working in Recovery Mode this operation takes less time. On my Nokia 8110 4G, for example, with dumpall.zip the total time is around 6 minutes, while in my last test from the PC shell it took around 15 minutes (setting the script to download everything to the computer directly should take less time, but certainly not less than when we work in Recovery Mode).

Here are some very useful tools that work similarly, depending on what you need to do and the type of device you have:

  • dumpall.zip by speeduploop is a powerful tool that dumps all the partitions into a folder;

  • dumpall-spreadtrum.zip by anthill from Discord is born because some Spreadtrum models have no "mount /system" option in Recovery Mode (for example the Energizer series). This tool only uses busybox from the zip;

  • dump_system.zip by Sylvain BLOT is needed if all you need is only a dump of your system partition, instead of using the dd command from the root shell. It will save a system dump named sytem.bin.

The main script of all these tools contain this (In addition are added the lines needed for the mount/unmount of the sdcard or the system):

dump_all(){
mkdir -p /sdcard/dumps
for P in $(ls /dev/block/bootdevice/by-name/); do echo "-- dumping $P" busybox dd if=/dev/block/bootdevice/by-name/$P of=/sdcard/dumps/$(basename $P).img done;}

You can easily open packages and study their internal scripts. As we have already seen in the guide on the backup from user space / normal mode, to create a backup image of the partition on the sd card, simply run from root shell:

dd if=/dev/block/bootdevice/by-name/PARTITION of=/sdcard/PARTITION.img bs=2048

Where PARTITION is the name of the partition whe want to save. For example, if we want do a backup of system is sufficient to do:

dd if=/dev/block/bootdevice/by-name/system of=/sdcard/system.img bs=2048

For the data partition it changes to:

dd if=/dev/block/bootdevice/by-name/userdata of=/sdcard/userdata.img bs=2048

and so on. In normal mode you can do the same, but taking longer than on Recovery Mode.

You may also be interested to...