Tarb, A Backup Solution for Android, With Recovery Mode Support

Search This thread

yassine2217

Senior Member
May 22, 2011
58
5
Casablanca
OnePlus 7 Pro
I would like to be the first to thank you for this solution, i have one question how to make a full backup all accounts and data i saw in the guide tarb -badsm10 . but im not sure if its full backup or no
 

VR25

Senior Member
Apr 20, 2013
1,978
4,820
github.com
I would like to be the first to thank you for this solution, i have one question how to make a full backup all accounts and data i saw in the guide tarb -badsm10 . but im not sure if its full backup or no
tarb -badsm10 . would backup the following:

a) All user and updated system APKs;

d) Data of those apps (also includes device-encrypted data (user_de), which can be excluded with D);

s) Generic system settings (quick toggles, sounds, display, etc.);

m) Magisk data (everything from /data/adb/, except magisk/ and magisk.db);

10) This instructs tarb to use 10 as the zstd compression level (default is 1);

This is a complete backup, except if you also want external data. If so, you would add the e flag.
External data includes /sdcard/Android/data/, /sdcard/Android/media/ (can be excluded with M), and /sdcard/Android/obb (can be excluded with O).

Note: backing up Google accounts on recent Android versions is just not a thing. You could try, but there's no guarantee that the restore will work. It may even cause problems. The target data keeps changing with new Android releases, and those changes are fairly unpredictable -- all thanks to Google, yay!
 

yassine2217

Senior Member
May 22, 2011
58
5
Casablanca
OnePlus 7 Pro
tarb -badsm10 . would backup the following:

a) All user and updated system APKs;

d) Data of those apps (also includes device-encrypted data (user_de), which can be excluded with D);

s) Generic system settings (quick toggles, sounds, display, etc.);

m) Magisk data (everything from /data/adb/, except magisk/ and magisk.db);

10) This instructs tarb to use 10 as the zstd compression level (default is 1);

This is a complete backup, except if you also want external data. If so, you would add the e flag.
External data includes /sdcard/Android/data/, /sdcard/Android/media/ (can be excluded with M), and /sdcard/Android/obb (can be excluded with O).

Note: backing up Google accounts on recent Android versions is just not a thing. You could try, but there's no guarantee that the restore will work. It may even cause problems. The target data keeps changing with new Android releases, and those changes are fairly unpredictable -- all thanks to Google, yay!
Thank you for the clear explaination
 

VR25

Senior Member
Apr 20, 2013
1,978
4,820
github.com
v2022.5.12 202205120
- C flag: exclude all *[cC]ache* files/directories globally (alternative to -X '*[cC]ache*');
- Do not backup/restore SSAIDs if /data/system/users/0/settings_ssaid.xml is encrypted;
- Updated info and support texts.

Try upgrading with tarb -u.
 
  • Like
Reactions: jakito

VR25

Senior Member
Apr 20, 2013
1,978
4,820
github.com
v2022.6.4
- cf899cd Remove debugging line, and reword a comment
- f8fdb0f Update help text
- bae6a39 C == "-X [Cc]ache" (non-greedy)
- 9a9138e Always exclude external cache
- 6d29dd6 Only restore SSAIDs and runtime perms after successful data restore
- fb0d1e9 Fix build/VERSION
 

jakito

Senior Member
Aug 9, 2016
126
69
OnePlus 7 Pro
Hello, I tried using this and I'm not having success. I installed as a Magisk Module with the -m flag and rebooted afterwards. Installed the arm64 as I have the SD855.

When I run the command tarb -badsm10 I get the following:
settings global
settings secure
settings system

/data/adb
And on the tarb folder I get a file with 30MB, that's all.

Thanks!
 

cave.man1908

Senior Member
Jan 5, 2013
127
80
OnePlus 9 Pro
Hello, I tried using this and I'm not having success. I installed as a Magisk Module with the -m flag and rebooted afterwards. Installed the arm64 as I have the SD855.

When I run the command tarb -badsm10 I get the following:

And on the tarb folder I get a file with 30MB, that's all.

Thanks!
Perhaps the period is missing at the end of command line. Write command as follows:
tarb -badsm10 .
 
  • Like
Reactions: jakito

VR25

Senior Member
Apr 20, 2013
1,978
4,820
github.com
How do you use this in recovery? This works for a12 and a12 recoveries?
Only custom recoveries that can decrypt data are supported.

If you've installed tarb as a Magisk module (-m), /data/t is available for use in recovery.

Run /data/t -badems ..
It'll backup (-b):
* All user and updated system apps (a) with respective data (d) and external data (e), excluding cache;
* Magisk modules (m);
* Generic system settings (s).

If you haven't installed it, assuming it's located in /sdcard/Download, run sh /sdcard/Download/tarb-arm64 -badems ...

Use adb shell or recovery's own terminal.
 

parag0n1986

Senior Member
May 3, 2015
322
75
36
LG V20
OnePlus 7 Pro
Only custom recoveries that can decrypt data are supported.

If you've installed tarb as a Magisk module (-m), /data/t is available for use in recovery.

Run /data/t -badems ..
It'll backup (-b):
* All user and updated system apps (a) with respective data (d) and external data (e), excluding cache;
* Magisk modules (m);
* Generic system settings (s).

If you haven't installed it, assuming it's located in /sdcard/Download, run sh /sdcard/Download/tarb-arm64 -badems ...

Use adb shell or recovery's own terminal.
So if I'm on an a12 custom ROM, I would have to flash DFE so I am unencrypted and this should work? I've tried DFE on a couple of the 12.1 ROMs and it doesn't work any ideas to get it unencrypted on all these new rooms? I'm assuming I have to use TWRP I didn't know if any of these a12s have a terminal yet
 

VR25

Senior Member
Apr 20, 2013
1,978
4,820
github.com
So if I'm on an a12 custom ROM, I would have to flash DFE so I am unencrypted and this should work? I've tried DFE on a couple of the 12.1 ROMs and it doesn't work any ideas to get it unencrypted on all these new rooms? I'm assuming I have to use TWRP I didn't know if any of these a12s have a terminal yet
Android ROMs almost never ship with a terminal emulator. You can always install one or just use adb shell.
Modern custom recoveries (TWRP and derivatives) all have a built-in terminal.
Some recoveries can decrypt data.
When this is not the case, one must disable forced encryption to be able to read /data from recovery (mandatory for tarb to work there).
If Magisk cannot disable encryption, you have to patch /vendor/etc/fstab* file(s). This is usually just a matter of replacing "fileencryption=" with "encryptable=", rebooting, and formatting (not just wiping) the userdata partition.
 
  • Like
Reactions: parag0n1986

parag0n1986

Senior Member
May 3, 2015
322
75
36
LG V20
OnePlus 7 Pro
Android ROMs almost never ship with a terminal emulator. You can always install one or just use adb shell.
Modern custom recoveries (TWRP and derivatives) all have a built-in terminal.
Some recoveries can decrypt data.
When this is not the case, one must disable forced encryption to be able to read /data from recovery (mandatory for tarb to work there).
If Magisk cannot disable encryption, you have to patch /vendor/etc/fstab* file(s). This is usually just a matter of replacing "fileencryption=" with "encryptable=", rebooting, and formatting (not just wiping) the userdata partition.
So basically, using ADB shell while you're in nameless or Evo X recovery, for example, is just like using the built-in TWRP terminal? Just need ADB enabled in recovery mode?

How do I have magisk disable encryption? I've noticed when you flash magisk, It usually shows keep verity and force encryption = true. How do you make magisk disable them when you first flash magisk?

Sorry about all the questions, just really want to learn this stuff more, and you're amazing for explaining this stuff! I miss being able to backup/restore data nandroid style!

One last question. You said manually patch /vendor/etc/fstab.qcom? Do you replace anything that says file encryption with encryptable, or only in the /userdata area in the fstab? Here is what mine says. Would love to know what change in there and put it back and reformat and be unencrypted on a12!
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,metadata_encryption=aes-256-xts:wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,quota,reservedsize=512M,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc,checkpoint=fs

That's line #45 in my fstab.qcom file. So from that, my current ROM is FBEv2? And f2fs format for data?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    tarb -r . will only restore app & data

    if additional is needed then use flags.

    ex. tarb -rade will restore app, data, ext data. And yes exclude the compression upon restore.
  • 8
    Backup/restore apps and respective data, SSAIDs, runtime permissions, generic system settings, Magisk modules, and more.

    Works in recovery mode as well.

    Refer to the upstream repository to get started.
    3
    I would like to be the first to thank you for this solution, i have one question how to make a full backup all accounts and data i saw in the guide tarb -badsm10 . but im not sure if its full backup or no
    tarb -badsm10 . would backup the following:

    a) All user and updated system APKs;

    d) Data of those apps (also includes device-encrypted data (user_de), which can be excluded with D);

    s) Generic system settings (quick toggles, sounds, display, etc.);

    m) Magisk data (everything from /data/adb/, except magisk/ and magisk.db);

    10) This instructs tarb to use 10 as the zstd compression level (default is 1);

    This is a complete backup, except if you also want external data. If so, you would add the e flag.
    External data includes /sdcard/Android/data/, /sdcard/Android/media/ (can be excluded with M), and /sdcard/Android/obb (can be excluded with O).

    Note: backing up Google accounts on recent Android versions is just not a thing. You could try, but there's no guarantee that the restore will work. It may even cause problems. The target data keeps changing with new Android releases, and those changes are fairly unpredictable -- all thanks to Google, yay!
    3
    v2022.6.4
    - cf899cd Remove debugging line, and reword a comment
    - f8fdb0f Update help text
    - bae6a39 C == "-X [Cc]ache" (non-greedy)
    - 9a9138e Always exclude external cache
    - 6d29dd6 Only restore SSAIDs and runtime perms after successful data restore
    - fb0d1e9 Fix build/VERSION
    2
    v2022.5.25 202205250
    - Architecture-aware self-backup
    - Build script gets version from changelog
    - Fixed `-rnx ['regex']`
    - Fixed settings backup output inconsistencies
    2
    v2022.5.16 202205160
    - Fixed "backup/restore stops right after gms";
    - Remind user to disable/remove Magisk modules that may cause bootloop;
    - Updated Telegram group link.