Is it possible to restore data partition backup to an android phone on the fly with just adb shell? adb shell dd if=/dev/block/mmcblk0p7 > backup.bin


works to backup android phone partition to computer but when I want to restore using


  cat backup.bin | adb shell dd of=/dev/block/mmcblk0p7


it didn't work. the shell continues waiting for input instead of writing to the target immediately that I expected.

Is there something wrong with the command?

Is it possible to cat a file to an android phone with just adb shell and internal commands on the fly(without push backup file to phone first)?



I found something more problem adb shell makes.(the extra 0x0D)
https://stackoverflow.com/questions/11689511/transferring-binary-data-over-adb-shell-ie-fast-file-transfer-using-tar


  It seems the adb shell command translates LF to CRLF:


So adb shell cat to local computer seems not so good. But I still want to know how to cat directly to remote shell.

The push to sdcard solution is not applicable while restore data partition to a phone without external storage support.
This will work on a linux:

adb shell dd if=/dev/block/mmcblk0p7|sed 's/\r$//' &gt; backup.bin


In MacOS it can be made to work as well, you just need to do it with Perl:

adb shell dd if=/dev/block/mmcblk0p7|perl -pe 's/\x0D\x0A/\x0A/g' &gt; backup.bin