Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy full disk image from Android to computer [duplicate]

Tags:

android

adb

I have a smartphone without the possibility to insert an SD-card. I would like to make a dump of the biggest partition (cause I lost files and I'd like to use a dump to recover them).

The partition is 10GB.

I was looking for an ADB command to pull using dd but nothing...

I tried to use Carliv touch recovery with a 32GB usb key by OTG but the USB key didn't mount ... Then I couldn't use "dd" directly on the phone using Aroma file manager and a terminal emulation.

Thank you!

I don't understand why they closed a question that has already an accepted answer by linking a completely different question. Copying a file and copying a partition are 2 different things.

like image 280
Alexis Avatar asked Apr 04 '15 04:04

Alexis


People also ask

What is disk imaging software?

Disk imaging is a form of hard drive backup that places all of a hard drive's data into a compressed file. That file can be stored on other devices, in a file system, or in the cloud. Disk imaging allows individuals and businesses to recover all data that was on a computer when the image was made.


2 Answers

As said in comment, adb pull /dev/block/mmcblk0 mmcblk0.img worked for me. A "DD image" is only a binary image file of the device.

like image 187
Alexis Avatar answered Oct 02 '22 13:10

Alexis


You want to copy a disk from your android device to your computer (preferably on your fastest drive) for faster and lossless analysis/recovery.

This is short step-by-step guide in windows (linux: scroll down) to achieve it using the linux tool dd intended for precise, bit-wise copies of data. Credits go to scandium on xda for the code, see his post for more details.

Prerequisites

  • make sure your device is rooted and busybox is installed

Windows:

  1. install cygwin. During install, add netcat (under Net) and pv (under util-linux) packages; the standard install is located in C:\ so make sure you have enough disk space beforehand;
  2. install adb e.g. through Android Studio. Make sure to add adb.exe executable file to the path variable to access it properly (guide).

  3. Open two cygwin consoles/terminals (one sending data, one receiving data) and enter in one of the terminals to enter the device:

    # terminal 1     adb forward tcp:5555 tcp:5555   # forward data over tcp connection     adb shell                       # open a connection     su                              # gain root access     BUSYBOX=/system/xbin/busybox    # default location for most bb installers      # note: adapt the variable `BUSYBOX` to point to your install directory     #       the TWRP default is `BUSYBOX=/sbin/busybox` (in case of bricked device) 
  1. Decide what partition to copy, the /dev/block/mmcblk0 partition is usually the one containing the data you typically would want.

  2. In the following code, adapt the partition name according to 4. and quickly one after another type in terminal 1 and terminal 2:

    # terminal 1     $BUSYBOX nc -l -p 5555 -e $BUSYBOX dd if=/dev/block/mmcblk0 
    # terminal 2     nc 127.0.0.1 5555 | pv -i 0.5 > $HOME/mmcblk0.raw     

This saves the partition in the cygwin home directory (in a nutshell: it sends/receives output of dd over a tcp connection)


Look at the files / analysis

  • To mount the partition in Windows you can use (OSFmount).

  • To analyze the files I recommend Active@ Undelete but there are tons of alternatives. With that program you can also directly load all partitions from the file (without mounting it, so step 5 is redundant in this case).


Guide for GNU/Linux users: install netcat and pv (step 1), use the Disks utility to analyze

like image 29
user2305193 Avatar answered Oct 02 '22 15:10

user2305193