Tarb, A Backup Solution for Android, With Recovery Mode Support - Android Software Development

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.

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

yassine2217 said:
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
Click to expand...
Click to collapse
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!

Cool, so this will replace Migrator right

VR25 said:
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!
Click to expand...
Click to collapse
Thank you for the clear explaination

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.

v2022.5.15 202205150
- Fixed -rnx ['regex'];
- -r shall have no fallback regex, just like -b;
- Skip GMS data backup/restore.
Try upgrading with tarb -u (interactive) or tarb -uu (no prompts).

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.

v2022.5.25 202205250
- Architecture-aware self-backup
- Build script gets version from changelog
- Fixed `-rnx ['regex']`
- Fixed settings backup output inconsistencies

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

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
Click to expand...
Click to collapse
And on the tarb folder I get a file with 30MB, that's all.
Thanks!

jakito said:
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!
Click to expand...
Click to collapse
Perhaps the period is missing at the end of command line. Write command as follows:
tarb -badsm10 .

cave.man1908 said:
Perhaps the period is missing at the end of command line. Write command as follows:
tarb -badsm10 .
Click to expand...
Click to collapse
Yes, that worked. My bad!
Thank you

Edit: fixed

How do you use this in recovery? This works for a12 and a12 recoveries?

parag0n1986 said:
How do you use this in recovery? This works for a12 and a12 recoveries?
Click to expand...
Click to collapse
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.

v2022.6.25
ece9f5c Add Zelle donation info
e667f34 Add support for -bnx 'regex'
b1d3484 Remove obsolete lines
2e50b94 Fix: incomplete apk backup
5b268d9 Flag D implies d; M/O imply e
d898768 Make "o" flag work with "-b" as well
9715bbb Update usage examples
ff40224 Exclude internal cache by default

VR25 said:
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.
Click to expand...
Click to collapse
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

parag0n1986 said:
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
Click to expand...
Click to collapse
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.

VR25 said:
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.
Click to expand...
Click to collapse
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?

Related

[GUIDE] Formatting EXT4 to F2FS without losing internal storage & data

Hi everyone,
This is a simple guide on how to fomat ext4 to f2fs without losing any of the internal storage & data.
Cuz, nowadays many ROMs, specially the new marshmallow ROMs are having F2FS support. And f2fs has much better I/O perfomance when compared to Ext4 (it really boosts your bacon's read & write speed)
IMPORTANT: F2FS is useful only if the ROM & Kernel which you are using supports F2FS (it shoud be written in the description in the thread of the ROM & kernel). If it doesnt support, & you formatted partitions as f2fs, then maybe you wont be able to boot.
Code:
/* DISCLAIMER:
*
* Your warranty is... still valid?
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about steps included in this guide
* before formatting the phone! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*
*/
First of all what is F2FS?
F2FS (Flash-Friendly File System) is a flash file system initially developed by Samsung Electronics for the Linux kernel.
The motive for F2FS was to build a file systemthat, from the start, takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks,eMMC, and SD cards), which are widely used in computer systems ranging from mobile devices to servers.
Benefits:
- Much Increased I/O speed
- Increase life span of flash storage due to less write required
- Doesn't suffer file size limitation of 4GB​
Why F2FS is better than Ext4?
Because, it has much better I/O perfomance when compared to Ext4. It also has much higher write speeds. It is specially meant for eMMC card & to use its full potential. See various benchmarks & comparison of Ext4 & F2FS here: http://forum.xda-developers.com/showthread.php?t=2697069​
I even got very high UX I/O Perfomance Score in AnTuTu Benchmark (much higher than my old ext4 exodus cm12 ux score) (UX Score 29513 out of total score 56581) (Sultanxda CM13 build 4.4.2016, lightning kernel, /data & /cache formatted as F2FS): https://forums.oneplus.net/threads/cm13-what-is-your-antutu-score-in-cm13.440380 (see screenshot). ​
Why am I making a seperate guide? Isnt this very easy?
Cuz, many people (even I before) didnt know that formatting /data, /system & /cache to f2fs would wipe the internal storage too, and at later would end up crying after losing their precious internal storage files. This had happened to me a few weeks ago. And this involves some other steps too. So I am making this guide so that others wont lose their precious files.​​
Pre-Requisites:
OnePlus One (lol) & working usb cable
TWRP 3.0.1
ROM & Kernel that supports F2FS
Windows Laptop/PC with ADB Drivers & ADB 1.0.32 installed (how to install adb driver & adb is given in Steps 4 & 5) & with atleast 60GB Space in your PC.
70% battery in your bacon atleast.
Procedure:
If you are gonna wipe /system & /data for flashing new ROM (like a new cm13 rom), then first take titanium backup of all the required stuff.
Reboot to recovery mode (TWRP)
In TWRP, Go to Backup >> Tick all the partitions >> Go to options tab & enable compression (this will make the backup process slower but will make the backup files smaller, optional) >> Swipe to backup >> Wait until backup gets over. Dont cancel.
After the backup process is complete, go to twrp home >> Mount >> Enable MTP (if the button shows Disable MTP, that means MTP is already enabled) >> Now connect your opo to computer/laptop. In My Computer or This PC, it should show up as A0001 >> Now open the device A0001 in This PC/Computer >> Internal Storage >> Select everything (dont miss anything) >> Right click > Copy >> Now make a folder anywhere (I made it in root of C: drive) >> paste everything. This will take some time, wait till everything gets over. MTP is too slow & sometimes some files do not copy properly. Instead, do this failproof ADB method (for windows user): Install Universal ADB Driver from here (ignore if you have already installed adb)
Now download minimal adb & fastboot from here >> Open the downloaded file (Its a setup wizard) >> when it asks for installation path, change the default path to "C:\adb" (without quotes) & install it.
Now open command prompt (press win+R from keyboard, type cmd & press enter) & type the following one by one:
Code:
cd c:\adb
adb pull -p /sdcard c:\bacon_full_backup
The full backup is gonna take several minutes. Relax with some music until then. :good:
Now you are ready to go! WARNING: This step will wipe your /system completely. But dont worry. Everything is safe in your PC. Now go to TWRP Home >> Wipe >> Advanced Wipe >> tick system (verify if your ROM & kernel supports /system as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your system partition is cleanly formatted to F2FS. [@Sultanxda's CM13 does not support /system as f2fs]
WARNING: This step will wipe your /data & internal storage (sdcard) completely!! . Go to TWRP Home >> Wipe >> Advanced Wipe >> tick data (verify if your ROM & kernel supports /data as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your data partition is cleanly formatted to F2FS, & internal storage is empty (dont get freaked out, everything is in your PC!). [@Sultanxda's CM13 supports /data as f2fs.]
This step will wipe your /cache. Now go to TWRP Home >> Wipe >> Advanced Wipe >> tick cache (verify if your ROM & kernel supports /cache as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your cache partition is cleanly formatted to F2FS. [@Sultanxda's CM13 supports /cache as f2fs.]
If you are flashing new ROM after wiping data & system, then skip the steps 12 & 13.
Now plug your opo into your PC & copy everything of the internal storage, which you copied erlier to your PC, back into the internal storage of OPO. This will take several minutes. MTP transfer is too slow. Instead, do the ADB method: Open a command prompt & type these commands one by one wait till it completes (will take a long time):
Code:
cd c:\adb
adb push -p c:\bacon_full_backup /sdcard
Now go to TWRP Home >> Settings >> tick use rm -rf instead of formatting (else while restoring the twrp backups, twrp will reformat the partitions as ext4 again).
Now go to twrp home >> restore >> select the latest backup (see the date & time in the name of the backup if you have multiple backups) >> tick every partitions >> tick enable md5 verification >> Swipe to restore.
Done.
Voila! Now your device is formatted as F2FS! Enjoy the much faster I/O read & write speed.
I actually made this guide here: https://forums.oneplus.net/threads/...-without-losing-internal-storage-data.439999/ & copy pasted in xda forum.
cool but i thought there would be no backup involved like windows where i changed from mbr to gpt without damaging data
Umm, So if I use 6.0.1 sultan I can format to f2fs except 'system' directory right?
That mean I need to skip step 6 . Am I right ?
Sorry for newb question XD
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
dwaipayanray95 said:
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
Click to expand...
Click to collapse
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
#sychrome# said:
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
Click to expand...
Click to collapse
No the author has has definitely put a great amount t of efforts to write.... I give him that.... I came to guide to find some other way of backing up the data from your internal storage partition directly... But copying g onto your laptop is something almost what everyone does... I think the warning that the OP gave after how formatting would erase the complete partition... I think it should indicate as to what happens.... He has stated that clearly too...
I was looking g for a better alternative
Might make sense to make a list of Roms and kernels that support F2FS, since people will come here out curiousity, and it would be the next logical step to find and flash a rom that support it.
Sent from my A0001 using XDA-Developers mobile app
the caf sultan 04/04/2016 suports system as f2fs? with Lightning Kernel v38?
hi. thanks for guide.
cd c:\adb
adb pull -p \sdcard c:\bacon_full_backup
Click to expand...
Click to collapse
but this lines dont work as should. for windows users this lines will work correctly (its work for me \ win 10 64)
cd c:\adb
adb pull -p /sdcard c:\bacon_full_backup
Click to expand...
Click to collapse
some things about 12 item:
for me adb dont want to work, because i wipe all partitions and didnt install the rom. After installing ROM, go to develop options and check adb debug, only after this step adb command in cmd was working well.
If i only convert to f2fs CACHE, so it lose internal storage & data?
Anzd said:
If i only convert to f2fs CACHE, so it lose internal storage & data?
Click to expand...
Click to collapse
Nope
so, can i do this tutorial on lastest stock cm13? or need custom rom?
Is F2FS stable yet? Last I heard it caused all sort of data corruption, freezing, etc.
How can I put a ROM on my phone after converting data and cache? In TWRP, mounting doesn't give me a storage device in Windows, and using ADB Sideload, it just gets stuck on 'starting service'. I plan to move from sultans CM12.1 up to CM13 but I dont know how to load a ROM zip onto the phone after converting the file system?
dwaipayanray95 said:
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
Click to expand...
Click to collapse
For me, who just wants to flash (and destroy and flash and destroy again - 2nd bootloader ftw!) his 7 year old Samsung Galaxy S1, is this completely new. Never heard of f2fs before today.
For the SGS1, only roms from 5.x on supports f2sf. But its manditory to try the 6.x roms.
I thankfully stumbled across this guide - now im only in the need to figure out, which from with version on TWRP & CWM can do this trick, where i can found them and what i need to do, to be able to flash them. (If your handset is on android 2.2/2.3, its not that easy to change to an up-to-date version)
dogroll said:
Is F2FS stable yet? Last I heard it caused all sort of data corruption, freezing, etc.
Click to expand...
Click to collapse
Yes bro its totally stable! I am usng it in my OPO since I made this guide, and never experienced any issues so far.
monyozt said:
so, can i do this tutorial on lastest stock cm13? or need custom rom?
Click to expand...
Click to collapse
Stock COS13 doesnt support f2fs.
Anzd said:
If i only convert to f2fs CACHE, so it lose internal storage & data?
Click to expand...
Click to collapse
No
lapapunk said:
hi. thanks for guide.
but this lines dont work as should. for windows users this lines will work correctly (its work for me \ win 10 64)
some things about 12 item:
for me adb dont want to work, because i wipe all partitions and didnt install the rom. After installing ROM, go to develop options and check adb debug, only after this step adb command in cmd was working well.
Click to expand...
Click to collapse
Yup sorry for the mistake. Its a slash instead of a backslash in adb pull \sdcard.I have updated it.
Someone pointed out the same mistake in my OPO forums thread and had fixed it, but forgot to fix it in XDA thread.
hello i read the guide to convert filesystem, byt when i tick partition system and changhe file system with twrp 3.1.0 i can not chose f2fs is not present why? only ext2 ext 3 ext4 etc but not f2fs? why???
thanks

Magiks on Moto Z play

I managed to have magisk and magiskhide working sucessfully, with some manual tricks and workarounds
There is a bug in f2fs that prevents /data/magisk.img to me mounted writable, so the tweek is just moving that file to the /cache partition, which is ext4 and creating a symlink to the original file.
So the steps for a working magisk is.
- Unlock your bootloader
- Install Twrp
- Flash magisk without mounting data partition and boot once.
- Reboot to recovery and open terminal (advanced)
- move magisk.img to /cache partition, changing name ( example: mv /data/magisk.img /cache/magisk_2.img)
- Create a symlink between_files ( ln -s /cache/magisk_2.img /data/magisk.img)
Would be nice if anybody can try to reproduce.
Ah, so there is a way after all. I gather it works normally afterwards, with phh superuser, xposed and everything? I'm willing to try and reproduce your steps if so, maybe tweak the installer script so it does this automagically as well.
lpchaim said:
Ah, so there is a way after all. I gather it works normally afterwards, with phh superuser, xposed and everything? I'm willing to try and reproduce your steps if so, maybe tweak the installer script so it does this automagically as well.
Click to expand...
Click to collapse
I did not installed Xposed because I wanted to pass SafetyNet, but I cannot think a reason why it shouldn't work.
jblancoperez said:
I did not installed Xposed because I wanted to pass SafetyNet, but I cannot think a reason why it shouldn't work.
Click to expand...
Click to collapse
Right. I think I'll try this out today and see how things turn out. As for SafetyNet, I though the unlocked bootloader alone was enough reason for it not to work, is this only for some models?
Update: So, @jblancoperez, I've reproduced your steps and Magisk Manager tells me it's installed but root isn't activated and it doesn't let me do anything else as a result.
Things to have a look,
Please confirm in the terminal if /magisk is mounted.
Go back to TWRP terminal and also confirm if the symlink is OK.
Nice to get the output from /cache/magisk.log
It took me a while to have everything right, doing it on TWRP is not the easiest places to move things around.
So, an update. Your method just wouldn't work for me at all, no matter how many times I tried. What worked was following the first part only, as in unmounting data and then flashing Magisk afterwards. I've tried Xposed and Viper4Android; they worked, but both did have to be flashed through twrp as opposed to Magisk Manager, which would throw an error. Not sure if that's on them or on this particular method. I should mention though that SafetyNet wouldn't pass even before xposed and with the hiding settings, not sure why.
You may want to try the kernel where the f2fs bug is fixed, which may be the cause when Magisk hide is not working which would cause Safetynet to fail.
Is there anyone wanting to test brand new Magisk 11.0 if it runs fine on Moto Z Play? With and/or without that f2fs fix?
tag68 said:
Is there anyone wanting to test brand new Magisk 11.0 if it runs fine on Moto Z Play? With and/or without that f2fs fix?
Click to expand...
Click to collapse
I got bootloop when I install magiks 11.0.
Do you have a logfile of that action in /cache or /cache/recovery which we could show in the Magisk thread?
I was able to upgrade the 10.2 installation.
Will try a new clean installation on the weekend with the f2fs fixed kernel.
I think I got why my procedure is not working for other people. Please try to copy the image instead of moving with the flags preserving de selinux attributes.
jblancoperez said:
Please try to copy the image instead of moving with the flags preserving de selinux attributes.
Click to expand...
Click to collapse
Keeping attributes when copying or moving is what my guide regarding timestamp is about. It's not that easy using Android.
tag68 said:
Keeping attributes when copying or moving is what my guide regarding timestamp is about. It's not that easy using Android.
Click to expand...
Click to collapse
I used the same cp commands @topjohnwu used in the magisk script, cp -afc orig dest.
jblancoperez said:
I used the same cp commands @topjohnwu used in the magisk script, cp -afc orig dest.
Click to expand...
Click to collapse
cp -a tries to copy attributes including timestamps. But it only succeeds if you are currently running as root.

[DONE] Can one unencrypt stock (rooted) Pie without losing data ?

As title suggest:
I run latest 10.0.4.0 stock Pie firmware. I am rooted (Magisk) and have Coscmidan's TWRP.
I wonder if there is a recipe to unencrypt and stay unencrypted. But I also do not want to lose user data during this transition.
A recipe perhaps like: "boot twrp, backup data, format data, restore data (assuming internal /data/media/0 already backed up elsewhere)".
But, perhaps, to avoid stock to encrypt again I may need 'Universal DM-Verity, ForceEncrypt, Disk Quota Disablers' zip.
However: I am slightly confused about double negation in documentation telling that name of ZIP determines what's DISABLED.
So I guess default Dm-Verity_ForceEncrypt may be what I need?
Thanks for help. have a nice day
Dior DNA said:
As title suggest:
I run latest 10.0.4.0 stock Pie firmware. I am rooted (Magisk) and have Cosmicdan's TWRP.
I wonder if there is a recipe to unencrypt and stay unencrypted. But I also do not want to lose user data during this transition.
A recipe perhaps like: "boot twrp, backup data, format data, restore data (assuming internal /data/media/0 already backed up elsewhere)".
But, perhaps, to avoid stock to encrypt again I may need 'Universal DM-Verity, ForceEncrypt, Disk Quota Disablers' zip.
However: I am slightly confused about double negation in documentation telling that name of ZIP determines what's DISABLED.
So I guess default Dm-Verity_ForceEncrypt may be what I need?
Thanks for help. have a nice day
Click to expand...
Click to collapse
I apologize for answering own question.
After reading Cosmicdan's and DM-Verity, ForceEncrypt documentation,
I went ahead as follows and kept fingers crossed:
recall : I ran latest 10.0.4.0 stock Pie firmware, rooted (Magisk) and have recovery Cosmicdan's TWRP.
Code:
boot system
backup /data/media to somewhere [I use rsync to a server]
boot recovery
backup data [just data]
format data
reboot recovery
treblize (userdata shrink) [so I do not have to do that later] <- optional
reboot recovery <- optional dependent on above choice
restore data [just data]
flash Dm-Verity_ForceEncrypt
flash magisk
boot system
restore /data/media from somewhere [I use rsync from a server]
I am unencrypted now and did not loose any data
Code:
[email protected]:# getprop | grep crypt
[init.svc.update_verifier_nonencrypted]: [stopped]
[ro.boottime.update_verifier_nonencrypted]: [20215637491]
[ro.crypto.state]: [unencrypted]
Hope it helps others.
interesting!
why is better to uncrypt the data partition?
riccetto80 said:
interesting!
why is better to uncrypt the data partition?
Click to expand...
Click to collapse
Not better. In fact, perhaps encrypted is better.
But some custom ROM or custom Treble GSI may not support encrypted so it is less of a hassle to each time switch between encrypted/decrypted when switching between some such custom ROM or custom Treble GSI. Also, switching between similar some such custom ROM or custom Treble GSI may perhaps be possible to attempt to flash dirty then.
Dior DNA said:
I apologize for answering own question.
After reading Cosmicdan's and DM-Verity, ForceEncrypt documentation,
I went ahead as follows and kept fingers crossed:
recall : I ran latest 10.0.4.0 stock Pie firmware, rooted (Magisk) and have recovery Cosmicdan's TWRP.
Code:
boot system
backup /data/media to somewhere [I use rsync to a server]
boot recovery
backup data [just data]
format data
reboot recovery
treblize (userdata shrink) [so I do not have to do that later] <- optional
reboot recovery <- optional dependent on above choice
restore data [just data]
flash Dm-Verity_ForceEncrypt
flash magisk
boot system
restore /data/media from somewhere [I use rsync from a server]
I am unencrypted now and did not loose any data
Code:
[email protected]:# getprop | grep crypt
[init.svc.update_verifier_nonencrypted]: [stopped]
[ro.boottime.update_verifier_nonencrypted]: [20215637491]
[ro.crypto.state]: [unencrypted]
Hope it helps others.
Click to expand...
Click to collapse
Idk if I'll need it someday or not, but thanks for the post, it's good to know things.

How to do full system backup to PC?

Before I handing in my OnePlus 6T for repair, I want to create a full system backup and reset the phone to factory defaults. Afterwards, I want to restore the original state. My phone is rooted with Magisk.
How do I do a full system backup?
What I tried:
adb backup -apk -obb -shared -all -system: This finishes, but at 5.5GB, even if compressed, the backup file is suspiciously small. According to the settings app, my phone uses 55GB of storage, so ten times that!
OK, so I thought adb root needs to be run before. However, that doesn't work: adbd cannot run as root in production builds
So I installed the adb_root module. But now when I run the above backup command, then it simply quits. No backup is created.
feklee said:
Before I handing in my OnePlus 6T for repair, I want to create a full system backup and reset the phone to factory defaults. Afterwards, I want to restore the original state. My phone is rooted with Magisk.
How do I do a full system backup?
What I tried:
adb backup -apk -obb -shared -all -system: This finishes, but at 5.5GB, even if compressed, the backup file is suspiciously small. According to the settings app, my phone uses 55GB of storage, so ten times that!
OK, so I thought adb root needs to be run before. However, that doesn't work: adbd cannot run as root in production builds
So I installed the adb_root module. But now when I run the above backup command, then it simply quits. No backup is created.
Click to expand...
Click to collapse
Do you have TWRP on your device? If so, just backup everything with it and copy the TWRP backup folder elsewhere.
ALSO (with the help of PC) copy the /sdcard (emulated sdcard; media storage). TWRP itself does not do that.
Done.
The reinstall TWRP in your device and restore everything. And copy back /sdcard
By the way, this is not Magisk related. For more information, better ask in your device specific section.
wilsonhlacerda said:
Do you have TWRP on your device? If so, just backup everything with it and copy the TWRP backup folder elsewhere.
Click to expand...
Click to collapse
Thanks for pointing me in the right direction! Here's how I proceeded in the end:
Downloaded TWRP for my device.
Rebooted the phone into fastboot mode by pressing volume down plus the power button and following the menu displayed on the phone. Note the process of entering fastboot mode varies from phone to phone.
Connected the phone to the PC, then booted TWRP from the Windows command line (cmd.exe):
Code:
fastboot boot twrp-3.4.0-0-fajita.img
I installed fastboot as part of the Chocolatey package adb.
In TWRP, I entered my password, then selected Backup.
Backed up all partitions to internal storage. See also the TWRP FAQ: What should I back up in TWRP?
Note that not all partitions need to be backed up, and in fact, according to the TWRP FAQ, it may be a bad idea to restore certain partitions. Still, it doesn’t hurt to have the backup of all of them.
Not included is /data/media (internal storage). This needs to be backed up separately. See the TWRP FAQ: What is EXCLUDED from a TWRP backup?
With TWRP running, I connected the phone via USB to my PC. Then I moved the following folder to my PC, which contains the TWRP backup of the phone:
Code:
This PC\OnePlus A6013\Internal Storage\TWRP
This step is not strictly necessary as in the following step I did back up the entire internal storage. However, it makes the next step execute faster as less data needs to be copied. The next step does not give feedback about progress.
For backing up internal storage I decided on the method found in Tadej Janež’s article Backing up Android's /data/media (i.e. internal storage) using adb and TWRP. From the Windows command line I ran:
Code:
adb exec-out "tar --create data/media/0 2>/backup-errors.txt | gzip" >internal_storage.tar.gz
After completion, to check for errors, I ran (no errors):
Code:
adb shell cat /backup-errors.txt
To leave TWRP, I rebooted the phone. Note that it is not necessary to install TWRP.
Restoration still needs to be tested.
By the way, this is not Magisk related. For more information, better ask in your device specific section.
Click to expand...
Click to collapse
I thought there was a Magisk way of doing a full system backup, making use of root privileges. Now I know better.
you can also try Migrator of vr25.
{Mod Edit: TG link removed}
https://github.com/VR-25/migrator
Just use Migrate
End of story.....
datsoy said:
you can also try Migrator of vr25.
{Mod Edit: TG link removed}
https://github.com/VR-25/migrator
Click to expand...
Click to collapse
Thanks! This looks nice, but I already backed up with TWRP. The idea was to get a 1:1 binary backup, and the backup did work. However, I am running into issues during restore of the Data partition: Error 255 when trying to restore Data

[TOOL][UNOFFICIAL][PORT] REPIT: for Nexus 7 (2013) [deb][flo]

This is a port of Lanchon REPIT.
- Nexus 7 (2013) Deb (LTE) and Flo (WiFi) -​
Disclaimer:
I am not responsible for your actions or consequences, directly or indirectly, related to the files and/or advice offered.
It is your choice to proceed.
What is REPIT?
REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices.
See the GitHub README for more on What REPIT is. GitHub - Link
Limitations:
Requires TWRP (or TWRP based) recovery.
Does not support encrypted devices.
Will cause data loss if the repartitioning process is externally interrupted.
See the GitHub README for more on Limitations. GitHub - Link
---
Notes:
A few years ago (September 2018), I made a port of REPIT for deb,flo and manta that was spread out between multiple threads.
Some comments and instructions were lost in thread chatter or just in a different thread altogether.
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Side note:
Lanchon added Nexus 7 (2013) to the official list. (November 2019)
Lanchon REPIT GitHub - Port Request - Commit
---
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Backup what you want to save and store it off device.
Copy it to your computer, cloud storage, USB, ...
Instructions:
This operation might take a long time and must not be interrupted.
- Depending on the device and REPIT configuration, this might take a few hours.
Make sure your battery is fully charged or mostly charged.
- You can connect to a charger while the REPIT script is running. May or may not charge depending on the recovery.
How To:
If you already have a ROM installed, repit will backup, change the partition, restore and resize.
- You can just reboot once the script finishes.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to system
If you are doing a clean install, add the +wipe option to system in the zip file name. This will speed up the partitioning since system will not be backed up and restored.
lanchon-repit-20210220-system=max+wipe-cache=16M+wipe-flo.zip
- Reboot back into TWRP after the script finishes.
- Then follow the instructions from the rom thread to install the rom you are going to use.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to recovery
Follow the instructions from the rom thread to install the rom you are going to use.
---
Changes:
Nexus 7 (2013) [Deb][Flo]
Pushed a bit pass the safe zone and claimed a bit more unallocated space.
Updated to the current REPIT scripts.
Separate zip files for deb and flo.
Nexus 7 (2013) GitHub - Commit
Download Links:
MediaFire - Link
SourceForge - Link
GoogleDrive - Link
Direct Download from MediaFire:
lanchon-repit-20210221-system=max-cache=16M+wipe-deb.zip MediaFire - Download
lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip MediaFire - Download
REPIT Links:
Lanchon REPIT GitHub - Link
- My fork GitHub - Link
Credits:
Lanchon for his excellent REPIT project.
The Android Community and everyone who has helped me learn through the years.
Cheers all.
Note about configuration.
The user configuration is done by renaming the zip file before flashing it.
Not much room to change on deb/flo.
The modifiable partitions are only system and cache (22 and 23).
The actual partitioning is done by a sector range. This is declared inside the script along with a default configuration.
Code:
# the set of partitions that can be modified by REPIT:
# <gpt-number> <gpt-name> <friendly-name> <conf-defaults> <crypto-footer>
initPartition 22 system system "same keep ext4" 0
initPartition 23 cache cache "same keep ext4" 0
initPartition 24 misc misc "same keep raw" 0
# the set of modifiable partitions that can be configured by the user (overriding <conf-defaults>):
configurablePartitions="$(seq 22 23)"
...
# the set of contiguous partitions that form this heap, in order of ascending partition start address:
heapPartitions="$(seq 22 24)"
# the disk area (as a sector range) to use for the heap partitions:
heapStart=$(parOldEnd 21) # one sector past the end of tzb.
heapEnd=$(parOldStart 25) # the start of recovery.
By default, REPIT will back up, restore, compress and/or expand a partition.
The +wipe option will wipe the partition.
The max option is an easy way to allocate the remaining space for a partition.
The misc partition is not part of the user-config but, it is in the sector range.
It will be moved to the the end of the sector range without alteration.
The default zip name lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip
Creates a 16M clean cache partition. (Wiped)
Uses the rest of the unallocated space in the range for system.
System is backed up and restored since the +wipe option was NOT added to system.
Since only system and cache can be configured, this only allows a few options for deb and flo.
Default zip name. -system=max-cache=16M+wipe-
Include wipe system. -system=max+wipe-cache=16M+wipe-
See the GitHub README for more on how to configure. GitHub - Link
Cheers all.
<RESERVE>
<RESERVE>
I think this deserves a bump, because, this is some great work right here for those wanting to stick with a stock-like partition layout!
Hi, I want to go back stock partition size. So i have to rename the zip.
What zip name?
ipdev said:
This is a port of Lanchon REPIT.
- Nexus 7 (2013) Deb (LTE) and Flo (WiFi) -​
Disclaimer:
I am not responsible for your actions or consequences, directly or indirectly, related to the files and/or advice offered.
It is your choice to proceed.
What is REPIT?
REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices.
See the GitHub README for more on What REPIT is. GitHub - Link
Limitations:
Requires TWRP (or TWRP based) recovery.
Does not support encrypted devices.
Will cause data loss if the repartitioning process is externally interrupted.
See the GitHub README for more on Limitations. GitHub - Link
---
Notes:
A few years ago (September 2018), I made a port of REPIT for deb,flo and manta that was spread out between multiple threads.
Some comments and instructions were lost in thread chatter or just in a different thread altogether.
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Side note:
Lanchon added Nexus 7 (2013) to the official list. (November 2019)
Lanchon REPIT GitHub - Port Request - Commit
---
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Backup what you want to save and store it off device.
Copy it to your computer, cloud storage, USB, ...
Instructions:
This operation might take a long time and must not be interrupted.
- Depending on the device and REPIT configuration, this might take a few hours.
Make sure your battery is fully charged or mostly charged.
- You can connect to a charger while the REPIT script is running. May or may not charge depending on the recovery.
How To:
If you already have a ROM installed, repit will backup, change the partition, restore and resize.
- You can just reboot once the script finishes.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to system
If you are doing a clean install, add the +wipe option to system in the zip file name. This will speed up the partitioning since system will not be backed up and restored.
lanchon-repit-20210220-system=max+wipe-cache=16M+wipe-flo.zip
- Reboot back into TWRP after the script finishes.
- Then follow the instructions from the rom thread to install the rom you are going to use.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to recovery
Follow the instructions from the rom thread to install the rom you are going to use.
---
Changes:
Nexus 7 (2013) [Deb][Flo]
Pushed a bit pass the safe zone and claimed a bit more unallocated space.
Updated to the current REPIT scripts.
Separate zip files for deb and flo.
Nexus 7 (2013) GitHub - Commit
Download Links:
MediaFire - Link
SourceForge - Link
GoogleDrive - Link
Direct Download from MediaFire:
lanchon-repit-20210221-system=max-cache=16M+wipe-deb.zip MediaFire - Download
lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip MediaFire - Download
REPIT Links:
Lanchon REPIT GitHub - Link
- My fork GitHub - Link
Credits:
Lanchon for his excellent REPIT project.
The Android Community and everyone who has helped me learn through the years.
Cheers all.
Click to expand...
Click to collapse
I have been trying to repartition Nexus flo 2013 following the steps outlined above with lanchon-repit-20210221-system=max+wipe-cache=16M+wipe-deb.zip for 19.1 version but keep getting Error 1, see photo. Any help will be much appreciated. Thank you
greenleaves said:
I have been trying to repartition Nexus flo 2013 following the steps outlined above with lanchon-repit-20210221-system=max+wipe-cache=16M+wipe-deb.zip for 19.1 version but keep getting Error 1, see photo. Any help will be much appreciated. Thank you
Click to expand...
Click to collapse
Problem fixed. Now 19.1, pico gapps and Magisk 25.0 were flashed in success. The problem was that I didn't follow through the steps carefully described on the OP to increase the partition sizes as follows:
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
greenleaves said:
Problem fixed. Now 19.1, pico gapps and Magisk 25.0 were flashed in success. The problem was that I didn't follow through the steps carefully described on the OP to increase the partition sizes as follows:
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Click to expand...
Click to collapse
Edit: NVM, i used restock to start fresh, and it all went fine. I've had this table kicking around long enough that I'm sure something was done that sysrepartundo couldn;'t undo.
How did you actually fix it? I ran sysrepartundo, am running it from the tmp folder with mtp disabled and nothing mounted, and still getting error 1. I've double check, all my partition sizes are stock.. I've been at this a few hours now and am getting frustrated.
theistus said:
I ran sysrepartundo, am running it from the tmp folder with mtp disabled and nothing mounted, and still getting error 1. I've double check, all my partition sizes are stock.. I've been at this a few hours now and am getting frustrated.
Click to expand...
Click to collapse
sysrepartundo is ancient and useless nowadays, try sysrepart-stock instead
Thank you for the script. I was able to repartion my flo and make it compatible with android 12L. Everything went smooth after realising (and correcting this mistake) that i"ve been putting the .zip inside /sdcard/tmp instead of /tmp (I was getting error 1 in TWRP).
During instalation process i"ve connected flo to charger and it indeed charged during repartition process
Things i"ve noticed
- TWRP appeared to be very laggy during repit process and took several seconds to reconginse the charger (to show to + sign next to the battery % to be precise)
- after device rebooted to stock 6.0.1, MTP didn"t work correctly. It appeared in my computer as "Nexus 7", but was completely empty. One more reboot (this time got short loading toast of "android is updating") and internal memory was visible from computer again
THANKS! It worked great for me also. I have mentioned it in the [GUIDE/TUTORIAL/HOWTO] Google Nexus 7 2013 Stock to Android 12 Tutorial.
Hi,
I had used @followmsi's sysrepart_1280_120.zip some time ago.
Now I'm interested in @followmsi's lineage 19.1 and want to use your lanchon-repit-20210221 script for increasing the system partition again.
Would you still consider the partition layout as stock, so I could use your script ? (See attachments)
And do I need a PC as the USB port is inoperative, so no way to connect to a PC?
Thank you very much in advance!
curiousde2002 said:
Hi,
I had used @followmsi's sysrepart_1280_120.zip some time ago.
Now I'm interested in @followmsi's lineage 19.1 and want to use your lanchon-repit-20210221 script for increasing the system partition again.
Would you still consider the partition layout as stock, so I could use your script ? (See attachments)
And do I need a PC as the USB port is inoperative, so no way to connect to a PC?
Thank you very much in advance!
Click to expand...
Click to collapse
You should be good to go.
Using one of the older (re)partitioning methods did not affect the partition table too much.
The note about a stock partition layout is mainly for users who used a (re)partition script that adds a separate vendor partition.
Cheers.
ipdev said:
You should be good to go.
Using one of the older (re)partitioning methods did not affect the partition table too much.
The note about a stock partition layout is mainly for users who used a (re)partition script that adds a separate vendor partition.
Cheers.
Click to expand...
Click to collapse
Would you recommend any precautions like putting files like restock on my device before running your script as I cannot connect to PC?
Thanks a lot for your help!
hi, i need some help, after using this script i can't seem to install any rom, i just can't format or mount any of my partitions, and sideload stops at some random %, anything i can do to restore? i backed up all files advised.
Hello, i'm having trouble installing Android 12L on my Nexus 7. I simply cannot get lanchon-repit to flash. It wont work, no matter how often I follow the steps and how thorougly I follow the guide. I tried everything. Already restored to "fabric-partitions" so on and so forth.
I'm constantly getting Error 1. I'm slowly losing my mind here.
Kind regards hoping for an answer
septchy
edit: also constantly says partition #30 not found.
I'm getting the following errors on flo:
Code:
FATAL: partition #31 unexpected
[ERROR 1]
Any ideas? Thanks

Categories

Resources