-1

I am looking for some tutorial or help to be able to make a backup of all Android partitions directly on my computer and be able to mount each of them from Linux to view them.

  • Making backup is possible but all of them don't have mountable filesystem. You can mount /data, /system, /cache and a few others with ext4, f2sf, fat etc. filesystem. Even you can mount directly from phone using UMS. Do you have root and custom recovery? – Irfan Latif Nov 6 '18 at 10:30
0

I don't know if it will work for your particular device and OS but I think this script is straight forward and you will be able to get the general idea and modify accordingly.

It first lists the content of /dev/block/platform/[xxxxx]/by-name directory (differs from device to device) then loops through the content files which in this case are partition names of your particular device. In each iteration it trims the 0x0d (carriage-return "\r") character that is added at the end of each file name, then it uses cat to print the partition to stdout of your terminal but we must also handle 0x0d (carriage-return "\r") byte that is added before newline(0x0a) before printing, then it calculates the md5sum of the output file which you can compare to the md5sum of the partition in your device to be sure there is no corruption.

#!/bin/bash
BY_NAME_DIR="/dev/block/platform/sprd-sdhci.3/by-name"
for partition in $(adb shell ls $BY_NAME_DIR)
do
            partition=$(tr -d '\r'<<<$partition)
            echo Backing up $partition partition
            adb shell "su -c cat $BY_NAME_DIR/$partition 2> /dev/null"|sed 's/\r$//' > ${partition}.img
            echo Calculating md5sum 
            md5sum ${partition}.img > ${partition}.md5
            echo Done backing up ${partition}
done

You can also refer to this question to see how you can handle the added "\r"(0x0d) characters

  • Make sure the transfer is done in binary mode (adb exec-out instead of adb shell), or the images might turn out broken. Doing so, you can also omit the sed part, as exec-out should take care for that. I'd also remove the 2> /dev/null part (at least while testing) so you see when something goes wrong. – Izzy Nov 6 '18 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.