9

How can I extract individual files from a backup created with TWRP? I’ve come across this answer, which is about extracting an APK from the system partition. However, I want to extract files from /data, which gets split across several files in the backup.

16

cat data.ext4.win??? | tar xvfi -

What this does is concatenate each file matching the pattern data.ext4.win??? and then pipe the concatenated files to tar for extraction. the - as the filename tells tar to extract from stdin. The i option ignores zero blocks which will be in between each archive file concatenated.

In this example I used the ext4 formatted data partition. Change data.ext4 to match the partition you are extracting.

Edited to reflect davidgo's comment.

31-Jan-2020 Edited to reflect Code Bling's comments.

| improve this answer | |
  • 1
    Really cool solution. I used a slightly refined version of this command to ignore the sha1 files - "cat data.ext4.win00? | tar -xv" – davidgo Aug 8 '18 at 8:38
  • This doesn't seem to work for me - it seems these are not standard tar files. i get errors tar: Removing leading /' from member names` and tar: Malformed extended header: missing equal sign. – JonasCz - Reinstate Monica Dec 21 '18 at 19:03
  • It appears you ran into a bug with TWRP, more information here stosb.com/blog/recovering-data-from-a-corrupt-tar-archive – Johnathon Havens Dec 22 '18 at 2:14
  • Is it possible that these files may be piped to tar out of order using this command? – Codebling Aug 15 '19 at 21:56
  • 1
    @CodeBling, You are correct, will change the answer to reflect, I must have just been lucky the files I was looking for were in the 000 archive. – Johnathon Havens Feb 1 at 0:02
6

The files created by TWRP with a *.win or *.win??? extension are tar archives. If a partition gets split across multiple files, each is a tar archive in its own right. Simply rename each file, giving it a .tar extension, and open it in your favorite archive tool (Engrampa on Ubuntu MATE has worked well for this).

| improve this answer | |
  • 1
    On Ubuntu opening them with double click errors: format not supported but I can extract them with tar -xvf And on Windows I can't extract them with 7-Zip unfortunately. – Shayan Aug 5 '19 at 21:05
2

Try BinWalk, it's a fast, easy to use tool for analyzing, reverse engineering, and extracting firmware images. and for more information take a look at this Quick-Start-Guide.

| improve this answer | |
0

Just extract it with winrar to a folder on desktop and that's it

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.