Monday, July 14, 2014

Backup Android photos with ADB

During my vacation a few days ago my Android phone (Samsung Galaxy S1) crashed unexpectedly.
I can only imagine that the reason was too little free sdcard space, but I'm not sure.
It happened to me already the second time and the first time I fixed it so that I rebooted the phone in recovery mode (reboot with pressing POWER + VOLUME UP + MENU buttons) and did factory reset, obviously loosing all data which was not backed up on the phone.
I think it could work as well this time, but the problem is I had plenty of nice picks done on vacation on my phone and would like to rescue them :)

This is what I did:

  1. Reboot phone in recovery mode (as described previously)
  2. Connect phone to PC with USB
  3. Run adb tool to restore photos to PC

I am using Ubuntu on my PC but the following would work similar on other OS. The only thing you will probably need to change is path to the temp folder on PC.

  • Run adb as root so that you can mount your sdcard in next steps

# adb root

  • Mount sdcard. Maybe you don't' need this step and your sdcard is already mounted. Mine was not.

# adb shell

then in shell type:

# mount /sdcard

Now you can list content of sdcard

# ls /sdcard

Among files on the list I could see folder DCIM
This is where camera photos and films are saved so I grab this to my temp folder.

  • Copy photos and videos to temp folder on PC

First exit shell:

# exit

Then copy:

# adb pull /sdcard/DCIM /tmp

This can take some of your drive space so be prepared otherwise the command will exit with message:
"No space left on device"


  1. This comment has been removed by the author.

  2. This comment has also been removed by the author.

  3. The author thought about removing this comment, but decided to leave it just to mess with people.