Backup and restore your Android phone using adb
Backing up your Android phone by using the phone manufacturer’s prescribed software is in most cases a chore, there is a more easy way to backup your phone’s data and apps using adb. Android Debug Bridge or adb as it’s commonly known is one of the command line tools that is part of the Android SDK package, this tool lets you communicate with your Android phone and can perform a variety of actions such as installing and debugging apps as well as helping to backup your phone’s data and apps safely and securely on your computer no matter which OS your computer runs on be it on MacOS, Windows, or Linux.
To get started on backing up your Android phone’s data and apps using adb, you need to have the tool installed already, if not, lifehacker has a guide on how you can easily install Android tools like adb on your OS of choice.
Once the adb tool is up and running on your computer, the next step is to enable developer options on your Android phone. Follow the steps below to do that (the screenshots below are from a phone running the latest Android software release (Nougat 7.1.1):
Step 1: Launch the settings app from the app drawer or notification shade
Step 2: Scroll to the bottom and tap on ‘About phone’.
Step 3: Scroll down in this menu and there should be an option labelled ‘Build number’
Step 4: Tap repeatedly on this option until you see a prompt on the phone’s screen showing the text ‘You have enabled development settings’
Step 5: Now go back to the main settings screen and scroll to the bottom, there should now be a new option labelled ‘Developer options’
Step 6: Now to enable adb debugging on your phone, tap on the ‘Developer options’ label and turn it on by tapping on the button near the top as shown below
Step 7: You should now get a prompt asking if you want to ‘Allow development settings?’, tap ‘OK’ to enable adb usb debugging. For some newer devices with the latest Android OS software installed, you might need to scroll to down the menu a bit until you see an option labelled ‘Android debugging’, click on this label to enable Android debugging on your phone
Now that you have enable adb debugging on your device, the next step is to connect your Android phone to your PC which should already have adb installed (you might get a prompt on your phone once you connect it to your PC asking if you want to allow USB debugging, enable the option to ‘Always allow from this computer and then tap OK) and then open your terminal(Linux) or command prompt (Windows).
To make sure your phone is detected by your PC via adb, in the terminal or command prompt, type the following command:
and press enter, if everything is working as it it should, you should get a similar response as shown below:
Now to backup your device (apps + data) using adb, still on your terminal or command prompt, enter the following:
- apk – Backs up your apps.
- noapk – Does not backup apps.
- shared – Backs up data on the SD card.
- noshared – Does not backup data on the SD card.
Your phone should now display a prompt asking you to enter a password if you want to encrypt the full backup of your phone, best to use a password to keep your data safe. Tap ‘BACK UP MY DATA’ and the backup up process will start.
There will be a prompt on your phone showing ‘Backup starting’
The backup time depends on the amount of apps and data you have on your phone. Once the process is complete, a prompt will appear on your phone stating ‘backup finished’ and the backup file will be in the current working location which is usually the user’s home directory for Linux users and in
C:\Users\your_user_name for Windows OS users.
To restore your phone from the backup file you created earlier, use the adb restore command on the terminal or command prompt (note: change the working directory to the location of the adb backup file)
Your phone will then prompt you for the password you used earlier to encrypt the backup file
Input the password and the tap on
RESTORE MY DATA to start the restore process, nothing else to do now but wait until the backup process is completed