using tar with arguments -cvpzf
where
c
for compressv
user verbose ( it basically prints out all files to console thar are being compressed )z
usegzip
as compression formatf
file were all compression should go
we need to say tar not to compress any device specific directories like /dev
, /sys
,/proc
& /run
we can use --exclude
for that
and also need to exlude file name where all gets compressed ( if you miss this tar
may go forever loop and swallow all your storage )
then so command looks like this
sudo tar -cvpzf /target.tar.gz \
--exclude={/dev,/proc,/sys,/tmp,/run,/target.tar.gz} \
--exclude-caches-all \
--one-file-system \
-C /*
PROTIP using
--exclude-caches-all
decreases size also use--one-file-system
for less errors
proot is same as chroot except it is in android we need to take care of more excludes or take gig's for device files
- after logging to your distro ( like after doing
proot-distro login ubuntu
)
sudo tar -cvpzf /target.tar.gz \
--exclude={/dev,/proc,/sys,/tmp,/run,/target.tar.gz} \
--exclude={/data,/apex,/vendor,/system,/sdcard} \
--exclude-caches-all \
--one-file-system \
-C /*
here why i excluded /data
and others in line 3:
/data
contains all user/app data which android wont led normal user to read or write/apex
( android pony express ) which is used for low level system module installer also not allowed to normal user/vendor
contains device specific libraries it is allowed to read but compressing is it no use cause you can't write it back/system
system directory is same as/vendor
in permissions/sdcard
is your internal storage ( you know why it is not recommended )
it is recommend to use this command after logging in cause permissions may differ before that cause error after restoring your distro