1

I've accidentally wiped my phone and lost all my photos. I'm going to try to run photorec on an image of my phone.

What I'd like to do is somehow something along these lines:

adb shell
dd if=/data of=/file/on/my/computer/not/on/phone

Is there any way to do this? I'm using a linux PC.

I saw this related question (Create a dd image of a Android 4.4.4 for forensics?) but it writes to the same device - my device is a nexus 6 so I don't have an sd card to write to (and doing so would likely over write the data I'm trying to recover)

1

2 Answers 2

1

This functionality has not been implemented in ADB yet. However, there are workarounds that some users have come up with. Check out this thread on XDA Developers for more information on how you can work around this limitation.

1

in recovery and like this

root@kali:~/Downloads# adb shell
~ # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print all                                                        
print all
Model: MMC 016GE2 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name      Flags
 1      4194kB  18.9MB  14.7MB               apnhlos
 2      18.9MB  71.0MB  52.2MB               modem
 3      71.0MB  71.6MB  524kB                sbl1
 4      71.6MB  71.6MB  32.8kB               dbi
 5      71.6MB  71.6MB  32.8kB               ddr
 6      71.6MB  73.7MB  2097kB               aboot
 7      73.7MB  74.3MB  524kB                rpm
 8      74.3MB  74.8MB  524kB                tz
 9      74.8MB  75.8MB  1049kB               pad
10      75.8MB  86.3MB  10.5MB               param
11      86.3MB  101MB   14.7MB  ext4         efs
12      101MB   104MB   3146kB               modemst1
13      104MB   107MB   3146kB               modemst2
14      107MB   118MB   10.5MB               boot
15      118MB   128MB   10.5MB               recovery
16      128MB   139MB   10.5MB               fota
17      139MB   146MB   7331kB               backup
18      146MB   149MB   3146kB               fsg
19      149MB   149MB   1024B                fsc
20      149MB   149MB   8192B                ssd
21      149MB   158MB   8389kB  ext4         persist
22      158MB   167MB   9437kB  ext4         persdata
23      167MB   2579MB  2412MB  ext4         system
24      2579MB  2893MB  315MB   ext4         cache
25      2893MB  2914MB  21.0MB  ext4         hidden
26      2914MB  15.8GB  12.8GB  ext4         userdata


(parted) q                                                                                                                                                                                                                       
q                                                                                                                                                                                                                                
~ # exit                                                                                                                                                                                                                         
root@kali:~/Downloads# adb pull /dev/block/mmcblk0p26 data.img
^Z                                                                                                                                                                                                                               
[1]+  Stopped                 adb pull /dev/block/mmcblk0p26 data.img                                                                                                                                                            
root@kali:~/Downloads# ls -al data.img && file data.img                                                                                                                                                                          
-rw-r--r-- 1 root root 111017984 Aug  5 01:03 data.img                                                                                                                                                                           
data.img: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files)                                                                                                                  
root@kali:~/Downloads#

note i interrupted the process, at game time don't do that! your block layout may vary but this is the general approach

4
  • Where did you get the parted from? It's not present in CM12 at least.
    – Firelord
    Aug 5, 2015 at 22:16
  • Firelord hi again, thanks for the editing, i am such a slob ! xD okay while in recovery and via adb after mounting system and then remounting system rw, cp /sbin/parted /system/bin/ and chmod 755 on reboot just run parted without any arguments to make sure it's perms are correct The parted source is in twrp source and Philz/cwm source btw
    – moonbutt74
    Aug 5, 2015 at 22:44
  • My TWRP doesn't seem to have parted binary. May be I'll have to build it from the source then.
    – Firelord
    Aug 5, 2015 at 23:04
  • 1
    Firelord, nah here is my AFH folder for tools 'n stuff androidfilehost.com/?w=files&flid=23810
    – moonbutt74
    Aug 5, 2015 at 23:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .