How to extract, create or edit android adb backups
What is an android adb backup?
An adb backup is a file with ab extension, generated by android's backup manager when we request it via adb shell. This allows you to backup some data of the phone, but is not a replacement of a clockworkmod backup:
- Each application files may be backed up or not depending on its policies. In some cases, the apk itself is never backed up even if requested.
- Usually for restoring an application's data it requires you to have it installed first.
- Inside an ab file is a tar file, which contains files and folders in a certain order. You have you respect that order in order to create a valid tar file.
- Inside the tar file, directories must not have trailing slash, for that reason pax, star or equivalent has to be used.
- There are some bugs present in the android source code.
- 'adb backup' or 'adb restore' are pretty slow, no matter what computer or phone you have, because the android debugging bridge has a maximum internal speed of about 1 MBps. So, each gigabyte can take about 15 minutes to backup or restore.
You can use java or perl, although with perl can be more complicated because requires downloading some modules from cpan and some ssl headers.
To know more information about types of android backups:
Types of Android backups
The entire process can be done from Windows, but is better to use a unix-like operating system, like Linux, OS X or BSD, since we should extract the files on a filesystem that preservers file permissions and owners and repack the tar archive. Furthermore some tools like star are easier to get for linux. In such cases, using Virtualbox or VMWare Workstation is highly recommended. Using Windows should work in any case whatsoever.
Java 7 or higher
- 7 or 7 (more builds - Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 if you are going to work with password encrypted backups. You need to install the files local_policy.jar and US_export_policy.jar under jre's lib/security folder, for example:- For Windows:- C:\Program Files\Java\jdk1.7.0_09\jre\lib\security\- C:\Program Files\Java\jre7\lib\security\- C:\Program Files (x86)\Java\jdk1.7.0_07\jre\lib\security\- C:\Program Files (x86)\Java\jre7\lib\security\- For Linux or BSD:/usr/local/jdk1.7/jre/lib/security/ /usr/lib/jvm/java-7-openjdk-*/jre/lib/security//usr/local/openjdk7/jre/lib/security/- For OS X:- /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/lib/security/Perl- Perl is available for several operating systems- libssl or openssl headers. If you are using Linux or Cygwin is much more easier- cpan modules required by use functionspax or staris an archiving utility that compresses in ustar by default. In this case is extremely useful because stores directories without trailing slash. Is available for all operating systems, and in windows can be installed via cygwin's setup.exe or download a native version like gnuwin32 (sometimes available via bsdtar with pax option).star allows storing directories without trailing slash. You can get the ubuntu version 1.5 grep com.rockstar.gta3 > gta3.list
5) Create the new tar archive. The directories stored on tar shouldn't contain trailing slashes, so I use pax or star instead of tar:
Types of Android backups
Perl scripts to encrypt/decrypt adb backup files
Full Phone Backup without Unlock or Root
Related adb backup and restore bugs: