I need help from you guys, because I don\'t know what I did wrong with adb backup.
I want to backup my Samsung Galaxy S3 LTE (GT-I9305) without root. I googled it and fou
The line, which correctly invokes adb
, needs to look like this at my side:
adb backup "-apk -obb -shared -all -system" -f phone-20180522-120000.adb
This line is for Linux, but should do for Windows and OS-X as well. For Linux (and probably OS-X), you can use a script like following, which automatically assigns a timestamp to the file:
adb backup "-apk -obb -shared -all -system" -f "${PHONE:-phone}-`date +%Y%m%d-%H%M%S`.adb`"
Important After doing a backup, verify your data! At my side, sometimes some corruption of the file shows up (and I doubt it is my computer, as I only observe such errors with
adb
).Here is a
check
instruction I use:set -o pipefail for a in *.adb; do echo "$a"; dd if="$a" bs=24 skip=1 | zlib-flate -uncompress | tar tf - >/dev/null; echo "ret=$?"; done
It should show
ret=0
, but it doen't.
- If you see
inflate: data: invalid code lengths set
your archive is corrupted and - very likely - unusable for restore!- If you see
tar: Unexpected EOF in archive
your backup probably is usable (all backups end this way, I do not know why).- Even if you see just
ret=0
there might be undiscovered errors which still prevent a restore.- There is definitively missing an
adb verify
command, to verify correctness of a backup!
I post this update, as all other answers were helpful, but not exact to the last detail. (When used with full quotes, a backup was done, but called backup.ab
)
Here is my environment:
The full procedure was (just in case somebody stumbles upon this not knowing what is needed):
adb
(on Ubuntu: sudo apt-get install android-tools-adb
)adb devices
- you should see something like XXXXXXXXXXXX unauthorized
OK
. First move the obstructing window.adb devices
- you should see something like XXXXXXXXXXXX device
ANDROID_SERIAL=XXXXXXXXXXXX
.)Now run adb backup
as shown above. Change the file to your needs.
Notes:
adb help
shows all possible options to adb backup
Apparently adb backup
does not completely backup everything!
I had a look into the backup (cd X && dd if=../XXXX.adb bs=24 skip=1 | zlib-flate -uncompress | tar xf -
) and did not find all installed applications.
What I was able to find was (note that this list is incomplete):
shared/0
shared/1
apps/
- many apps (like Google Authenticator) were missingapps/com.android.providers.calendar/db/calendar.db
(probably)What I was not able to find (note that this list is incomplete):
share/1
. For example the apps, which are moved-to-SD.)Conclusions:
adb backup
might create corrupt backups, which can go unnoticed. So either check your backup or do frequent backups and pretend to be lucky enough such that not all backups go corrupt.adb backup
you get a backup of most of your precious data, like camera images and so on. It might be a bit difficult to unpack it, though.adb backup
is not enough to do a complete backup of your phone.adb backup
is not enough to backup your SD-card such, that if it breaks, you are able to replace it by a new one with the contents restored. This is very sad!PS: The typo "Forth" is not an accidental one.
PPS: zlib-flate
can be found in package qpdf
on Ubuntu 18.04