Backup and restore your Android phone with ADB (and rsync)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Backup and restore your Android phone with ADB (and rsync)

It will backup and restore all of your /sdcard directory. Assuming you're using also something like Titanium Backup you'll be able to backup and restore all your apps, settings and data.

It uses ADB for setup and rsync to do the copying since the Android File Transfer Tool for Mac has a laughable quality for Google’s standards.

It's based on a pure ADB version by Riyad Preukschas and has been improved with ideas and methods from Simon Josefsson and pts.


Assuming you've installed and setup ADB from Android's SDK tools package. Download and extract the current version.

wget -O android-backup-master.tar.gz
tar xzf android-backup-master.tar.gz
cd android-backup-master/

Move the files to their necessary locations.

# move scripts to a directory on $PATH
mv android-backup android-restore /usr/local/bin/
# move backup rsync to a location where it can be found
mkdir /usr/local/lib/android-backup
mv rsync.bkp /usr/local/lib/android-backup/

Make sure that the directory you move android-backup and android-restore to is in $PATH.



Connect your phone via USB. Make sure you have set up ADB debugging already. Then run:

android-backup [<backup-dir>]

If you haven't given a backup directory it will ask you if it should generate one for you.

If you have an older backup already you can use it to speed up the backup process. Rsync will automatically find out what files to download leaving out those that have not changed in the mean time.

cp -r previous-backup/ current-backup/
android-backup current-backup/


Connect your phone via USB. Make sure you have set up ADB debugging already. Then run:

android-restore <backup-dir>


  • Currently restoring will not be able to be able to restore the correct timestamps of files. They'll be set to the current date and time when you're restoring them.

Extract Rsync for Android Yourself

The provided rsync.bkp file was extracted from LineageOS 14.1-20170131-NIGHTLY for OnePlus X via

adb shell which rsync
adb pull /system/xbin/rsync rsync.bkp

Build Rsync for Android Yourself

NOTE: The following steps assume you already have the Android NDK installed.

Clone the rsync for android source (e.g. from @CyanogenMod) ...

git clone
cd android_external_rsync
# checkout the most recent branch
git checkout cm-14.1

... create the missing build file ...

mkdir jni
# create missing build script (e.g. from
wget -O jni/

... and start the build with:

export NDK_PROJECT_PATH=`pwd`
ndk-build -d rsync

Find your self-build rsync in obj/local/*/rsync.

Contact and Issues

Please, report all issues on our issue tracker on GitHub: