Android adb Backup and Restore

What is ADB?

ADB stands for Android Debug Bridge. As the name suggests it is intended for developers to debug apps from her/his machine. ADB is a part of Android SDK which is available for Linux, Mac and Windows Desktop OS’s.

How to Connect to ADB?

You need a PC and the compatible cable (Micro USB in most cases, can be proprietary) to connect your Android Phone/Tablet. To use ADB interface enable USB Debugging in your phone under Developer Options. You can enable Developer Options menu in Android 4.0 and up by tapping Build Number under About Phone or About Tablet menu for 7 time repetitively. After you get the toast message confirmation, hit back and Developer Options will appear around About menu. Enable USB Debugging under the same. ADB command which you need to run on your PC is included in Android SDK’s “platform-tool” directory. You also need driver for your device which can be downloaded via most of the manufacturer’s website, otherwise XDA-Developers is a good source for the same.

Create ADB Backup

After you have connected everything, open a command prompt / shell in the directory you want backup to be saved —

adb devices

This is to make sure your device is working over ADB and Authorize your PC to run adb on your device. In newer version of Android you will get an Authorization prompt over your phone screen to allow the debugging from your PC; accept that. If this command shows you a device with a serial/identity, you are good to go.

Following is the description of adb backup and it’s option which you can get by simply running adb over the prompt —

adb backup [-f ] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] []

Depending on your requirements you can include/exclude the options from this. A typical command to take backup of all installed apps along with their data excluding system apps and sdcard contents would be —

adb backup -f allapps.ab -apk -noshared -all -nosystem

This will prompt you in full screen on your device to backup along with an option to set password. You need to remember the password while restoring as well, so it’s all OK to not provide any password if your PC is privately used.

After the process completes you will have a allapps.ab file in the folder where you ran the commands, this includes all the user apps which you installed along with app-data. It will NOT have any system app or data, any sdcard files not even obb, and some apps which doesn’t allow backup, such as Whatsapp, Dropbox or Twitter to name some. I will cover how to backup these to move to another phone in other article.

Restore ADB Backup

You can restore the backup you have created using a simple adb command again to the same or a different device —

adb restore allapps.ab

This will again prompt you on device screen with an option to provide password. If you setup a password for your backup while creating, provide it, otherwise simply proceed with Restore.

Once this process completes, you will have your apps in the same state as you backed up, as app-data has also been moved. Note that moving app-data is not possible with any other option than ADB for a unrooted Device. Rooted devices have apps to take app-data backups easily.

Let me know if you want me to elaborate any part of the write-up or you get any problem doing this.

2 comments

  1. Great weblog here! Also your web site lots up very fast!

    What web host are you the use of? Can I get your affiliate link to your host?
    I desire my web site loaded up as quickly as yours lol

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.