adb backup and adb restore

So I want to root my Nexus 4. Do full backup using adb, root it, and restore it... but failed. And my data almost gone :(

Before doing this, you must enable Developer mode, Enable USB debugging, install ADB on your laptop.

To backup:
adb backup -f backup.ab -apk -shared -all -nosystem
#add -nosystem for unrooted device or will hang

Then root your device:
#please find tutorial elsewhere

Reboot your phone, say no to all question, enable USB debugging again

Reboot your phone, add all google accounts, install all purchased app.

Before restoring, enable Airplane mode, Stop all possible task from Settings - Apps - Running

Open other console to monitor restore progress, run adb logcat

Now restoring,
adb restore backup.ab
#unlock phone and click Restore
#wait until no other progress (watch on other console)
#reboot, Ctrl-C and try to repeat restore until restored normally
#restoring shared data will take long time

UPDATE:

Use my script to backup all apps to separate files:

#!/bin/bash

BASE=backup
APPTP=`adb shell cmd package list packages -3 | awk -F: '{print $2}' `
BASESYS=backup-sys
APPSYS=`adb shell cmd package list packages -s | awk -F: '{print $2}' `

echo "-------------- BACKING UP 3RD PARTY APPS -------------- "
sleep 5
mkdir $BASE

for app in $APPTP; do
    echo $app
    adb backup -f $BASE/$app.ab -apk -obb $app &
    sleep 1
    adb shell input tap 820 1720
    wait
done

echo "-------------- BACKING UP SYSTEM APPS -------------- "
sleep 5
mkdir -p $BASESYS

for app in $APPSYS; do
    echo $app
    adb backup -f $BASESYS/$app.ab $app &
    sleep 1
    adb shell input tap 820 1720
    wait
done

echo "-------------- BACKING UP INTERNAL STORAGE -------------- "
sleep 5
adb pull -a /sdcard

Comments

Popular posts from this blog

Ports to allow for whatsapp call

Manually clean up zimbra zmcat/zmcpustat exploit

Keychron K2 in Linux