Thursday, January 28, 2016

adb - How to take full image backup of partitions or eMMC?


I have an Archos 55 Platinum here. There is also a unofficial TWRP, if this might help. I would like to make a backup of the storage of the phone, like dd for any partition, so I can inspect the content later.


Also, I don't want to root or flash anything, nor install apps.


Is there a way that allows me to run TWRP via fastboot instead of flashing? Any ideas how I can proceed?



Answer



Yes you can boot in TWRP if bootloader is unlocked:


fastboot boot /path/to/twrp.img


Then you can simply dd whole eMMC or individual partitions. You need some extra memory (on external SD card) to backup whole eMMC or /data partition. Smaller partitions (including the biggest one: system) can be backed up to internal memory i.e. data partition.


For Qualcomm SoC:
(for MTK devices, path is slightly different)


dd if=/dev/block/(bootdevice/)mmcblk0 of=/path/to/external-sd/emmc-backup  

For single partition:


dd if=/dev/block/bootdevice/by-name/userdata of=/path/to/external-sd/data-backup

In order to come up with shortage of space, instead of using SD Card you may save backup files directly to PC using adb shell or exec-out. Thanks to @Izzy:



adb exec-out dd if=/dev/block/(bootdevice/)mmcblk0 > emmc-backup.img  

Make sure your adb binary (on Windows or Linux) supports exec-out. Also take care that unwanted non-printing terminal characters don't get included in output.


There are also other methods like adb pull, UMS or streaming over network. For details see How to recover a deleted file from /data partition?


PS:


Another way to save space and to speed up backup process is to backup only the contents of mountable filesystems instead of whole partition image. Particularly userdata and system are larger partitions but they aren't usually completely filled. Mount them and create backup archive using tar so that zeroed out portion of these partitions isn't backed up.


Make sure to preserve all file permissions and attributes (whatever applicable depending on filesystem etc.) including classic UNIX file mode and owner, ACLs, XATTRs and SELinux contexts. These options are supported by tar. Otherwise things might get messed up. See more details in How to stream an encrypted backup of the entire device to remote host?




RELATED:




No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...