How to use ADB Commands to Backup and Restore Nexus 5

Updated on September 1, 2017

In continuation to my HowTo tutorials on Nexus 5, today I will show you the backup and recovery procedure using the well known method called “ADB”. Of course, there are plenty of applications out there that helps you to backup your apps, settings, wi-fi passwords etc…to cloud storage and also lets you recover those in case of data loss. But advanced users want to backup their device using ADB tools and that’s what we are going to learn today.

Backing up your applications, its data and sdcard is one of the most important process, as it can save lot of time and effort when you lose your mobile or in case if it needs to wiped off.

Prerequisites 

You need to download Android SDK from Android.com and unzip it anywhere on your PC. You should also get your data cable ready to connect the device to your desktop. In case, if you face any problem in connecting the device to windows, just check this article.

The backup and recovery method using ADB should work for both the Stock and Rooted devices.

Backup Apps and its Data

Step 1: Go to Settings > Developer Options and enable USB debugging.

Step 2: Connect your device to PC

Step 3: Launch command prompt ‘cmd‘ in your PC and cd to the directory where you have android SDK unzipped.

Step 4: Run the below command to see if ADB is able to detect your device

adb.exe devices

The above command should display device serial number.

Step 5: Now run the below command to initiate the backup process

adb backup -apk -noshared -all -nosystem

Step 6: Go back to your device and accept the Backup process. You may choose to set a password to encrypt your backup data. Wait until the process is completed successfully. It will create a backup file named ‘backup.ab‘ in your PC at the current location; backup.ab includes the backup of your apps and its data.

adb command to backup apps

Restore Apps and its Data

Step 1: Go to Settings > Developer Options and enable USB debugging.

Step 2: Connect your device to the PC

Step 3: Launch the command prompt ‘cmd’ in your PC and cd to the directory where you have android SDK unzipped. Remember, this is the directory where you downloaded the backup.ab file.

Step 4: To restore the backup.ab file, just run the below command.

adb restore backup.ab

Step 5: Go back to your device and accept the restore process. If you had set password to encrypt the backup data, then you will have to enter the same to decrypt it. Wait until the process completes successfully.

ADB command to restore backup

Backup your sdcard to PC

Follow the above procedure to connect your device and run the below command in ‘cmd’.

adb pull /sdcard/ /sdcard/

The above command will copy your sdcard data to a folder called ‘sdcard‘ under C-Drive. This process will take few minutes depending upon the size of your sdcard.

Restore your sdcard data to PC

Follow the above mentioned steps to connect your device, enabling usb debugging and run the below command.

adb push sdcard /sdcard/

The above command will restore the data to your sdcard. This process will take few minutes depending upon the size of the backup data.

Was this article helpful?

Related Articles

Leave a Comment