About | Blog | Downloads | Projects |

How to backup your Android device

Jul. 13, 2022

There are a million tools, programs and methods to backup your desktop, laptop, server etc but there is never mention of backing up your phone despite it probably being your most used device. It is under the assumption by phone manufacturers and the general public that you are probably using some cloud storage like Google drive or Google photos to backup the files on your phone.

For those who do not wish to use cloud storage, I found a neat solution on stackoverflow: https://stackoverflow.com/questions/55359419/can-rsync-be-used-to-transfer-files-from-android-client-to-linux-server-programm. I managed to transfer 50k images from my phone to my computer in 20 minutes.

To sum it up, use rsync and adb.

  1. Install a terminal on your Android device. I use Termux. Make sure it has storage access permission.
  2. Install rsync on your computer.
  3. Set a password for the default user on your phone. Use command passwd
  4. Start the SSH daemon on your phone terminal (sshd)
  5. Install adb on your computer. https://developer.android.com/studio/command-line/adb
  6. Plug in your Android device. You may want to enable USB debugging and grant it access to files
  7. On your computer: adb forward tcp:8022 tcp:8022.
  8. On your computer: rsync -av -e 'ssh -p 8022' localhost:/storage/emulated/0/[target_folder] /[destination]