exclude just /media as in the given command.Yes I understand it. basically you can't backup to it while it's in use. so it needs to be excluded. So since these are all the same paths "/data/media = /storage/emulated/0 = /sdcard", would it be enough to just exclude "/media*" or would you need to exclude "/data/media*", and "/storage/emulated/0*", and "/sdcard*"
Thanks!
adb shell
su #Magisk prompts you to grant root access for shell
PATH=/data/data/com.termux/files/usr/bin
SHELL=/data/data/com.termux/files/usr/bin/sh
Open Termux on your phone and run 'pkg install tsu' to install 'Termux su'. After that and after 'SHELL=/data...' you can run 'tsu'. That then brings you in a clean way into the Termux shell.exclude just /media as in the given command.
To use Termux via ADB:
Code:adb shell su #Magisk prompts you to grant root access for shell PATH=/data/data/com.termux/files/usr/bin SHELL=/data/data/com.termux/files/usr/bin/sh
I'll try these commands and see if I can get it. Basically I would use this command right?Open Termux on your phone and run 'pkg install tsu' to install 'Termux su'. After that and after 'SHELL=/data...' you can run 'tsu'. That then brings you in a clean way into the Termux shell.
tar -cv --exclude='media/*' --exclude='*-cache' --file=/data/media/0/data.ext4.win000 /data
why did you add --exclude='*-cache'? This would exclude /data/dalvik-cache since there's no other path with '-cache' on /data.I'll try these commands and see if I can get it. Basically I would use this command right?
Code:tar -cv --exclude='media/*' --exclude='*-cache' --file=/data/media/0/data.ext4.win000 /data
This was meant to be for Nexus 5 and a directory called data-cache. I assume it's an app cache but it's not used anymore on modern Android devices. Instead of this the option you add won't save ~/dalvik-cache. In general that's not an issue and on first boot the system will recreate the files. But it takes a few minutes and you could skip the waiting time by not excluding it.I added the cache because I came across this post: https://github.com/dlenski/tetherback That dev made a comment that for twrp backup for the data mount point
So I thought to include that as well.
--exclude='media
*' while I used --exclude='media/*'
./data/mediafile
/data/media/0
/data/media = /storage/emulated/0
what is indeed /data/media/0 = /storage/emulated/0
. I forgot the folder '0' that is specific to the user. You are user_0 and every new one will be created ongoing as user_1, ..., user_n.# excluding 'media/*' saves:
/data/
/data/media
/data/mediafile
=> /data/media/0 is excluded
# excluding 'media*' saves:
/data/
=> all folders and also ALL FILES beginning with 'media' are excluded what is NOT desired!
# excluding 'media' saves:
/data/
/data/mediafile
=> this is the best practice and I would
recommend you to use this argument.
the folder ~/media/0 gets created on first boot by
the system. So, you don't need to save
/data/media with your backup. but apart from
that this argument will save all files beginning
with 'media'.
@echo off
cls
pushd "%~dp0"
adb shell su <test.txt
Pause
cd "/data/data/com.termux/files/usr/bin"
tar -cv --exclude='media' --file=/data/media/0/data.ext4.win000 /data
did you grant root permissions to "shell"?Thanks for the explanation and clarifying everything. I had a chance to test this out and here are my results.
I created 2 small scripts
batch script
Code:@echo off cls pushd "%~dp0" adb shell su <test.txt Pause
test.txt
Code:cd "/data/data/com.termux/files/usr/bin" tar -cv --exclude='media' --file=/data/media/0/data.ext4.win000 /data
It took less than 1 minute to run which is pretty fast. It saved the "data.ext4.win000" data file and it shows 20Gb, however the last line in the output of the batch file states "tar: had errors". Is there a way I can see what the errors are?
the su is in the batch script. I tested it out by the command "whoami" and it returned root.did you grant root permissions to "shell"?
The line »cd "/data/data/com.termux/files/usr/bin"« is useless in your case.
yes, you are in
SHELL=/system/bin/sh
and therefore /system/bin/tar
will be used by the system. That's why I told you to change the shell variables PATH= and SHELL=. ./tar
/data/data/com.termux/files/usr/bin/./tar
cd "/data/data/com.termux/files/usr/bin"
./tar -cv --exclude='media' --file=/data/media/0/data.ext4.win000 /data
tar -cv --exclude='media' --file=/data/media/0/data.ext4.win000 /data
These variables are only set for the current session like any other variables you declare in a script. You can call the value withBy the way, when I set the path and shell variables is that only within the current session or is it permanent now any time I use ADB?
echo $PATH
or echo $SHELL
or all values with set
./data/data/com.termux/files/usr/bin/./tsu
pkg install tsu
Rename
data.ext4.win000
to data.ext4.win000.tar
and it's readable and can be opened with any archiver software like WinRAR or 7z on Android/Windows. That's the easiest way to check the archive for errors/missing files.anr
bootchart
misc
tombstones
unencrypted
vendor
vendor_ce
vendor_de