Extract backup made with adb (with --twrp option)

Search This thread


New member
Mar 8, 2017
I have a Samsung Galaxy S2 GT-I9100 smartphone with LineageOS and TWRP. Every week I make a backup with the following command:

adb backup -f twrp-20170322.ab --twrp boot data system

I may optionally use the --compress option, too.

Is there a way to extract the twrp-20170322.ab backup file with stardard GNU/Linux command line tools? There are a number of tutorials online that use dd/tar/openssl, but they don't work when using the --twrp option.

I will also consider installing extra software if needed, but it must be free (as in freedom).



Recognized Developer / Recognized Contributor
Oct 2, 2012
Here is the documentation of the file format:


Unfortunately that's not clear enough to write an unpacker, but my code review comments about improving the documentation were ignored and the feature was merged anyway. So someone has to actually read the code and/or a sample backup to reverse engineer the format - it's not hard, but it shouldn't have been necessary.

Top Liked Posts

Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone