#### Restoring photos from an android phone

18-05-2016 22:24 by myia

I really dont like smartphones, thats why i dont know them well. But i had to help, restoring deleted photos on an Samsung Galaxy S5 Neo.

### The SD-Card

This part ist easy. All i had to do was to use photorec. But first i create a bitwise copy of the card to work with:

# find the right blockdevice:
lsblk
# sdX is the device you found with lsblk (without the partition number) i. e. sdc
sudo dd if=/dev/sdX of=card_backup.img bs=4M; sync


Then you can use photorec with the image:

photorec card_backup.img


In photorec i disabled all other filetypes but "jpg". That's all.

### The internal storage

First i hoped, that i could mount the phone just like an external harddrive. But they dont want to make it easy. It ist possible to browse the phone with adb with is (at least in archlinux) in android-tools, or an ssh or ftp server [1]. but that doesnt help me to restore the photos. I need a raw image of the partition.

Then i found a blog post [2] which look really good: using the adb shell and cat to write the whole blockdevice from the smartphone to the pc, but unfortunely the smartphone had to be "rooted" and i didn't want to that much with this phone. But i did a quick search and it worse than i though: A lot of persons are sharing strange binaries, an nearly no information, what they did to root the device. It seemed to me like a big backdoor-party. All instructions were like: download this and install it to your windows machine, than download that and put it in the newly installed programm, to put it oin the phone… yay.

So i came back to adb. Adb has an backup option, which i used with adb backup -all but the file was only 150MB big, so i thought it may only saved some systemfiles. But you can also use adb backup -shared -f backup_shared.ab [3]. In this post the tell you not to make backups with adb backup beacuse its not finished, but in this case this is regardless. After that, i had a 6GB file, but feeding it to photorec didnt give any results. Maybe i have to decompress it,