Skip to content

Backup & restore proot linux

Zman-1x1 edited this page Jun 21, 2021 · 6 revisions

Here a handy alternate method to tarball your proot Linux.

requires running prooted Linux with tar


Backup

  • Give termux to write into internal storage
termux-setup-storage
  • launch your linux
proot-distro launch <distro_name> 

let think that your backup file name is hippo.tar.gz and location you want to save it is /sdcard, then overall command looks like this

tar -cvpzf /sdcard/hippo.tar.gz    \
    --exclude-caches-all    \  
    --exclude=/dev/*        \
    --exclude=/sys/*        \
    --exclude=/proc/*       \
    --exclude=/run/*        \
    --exclude=/data/*       \
    --exclude=/storage      \
    --exclude=/vendor/*     \
    --exclude=/sdcard       \
    --exclude=/hippo.tar.gz \
    /* --one-file-system 2> errors.txt

here

  • /dev,/sys,/proc,/run are device-specific and android won't even let them copy so they are excluded.

  • /data is the folder where all android app data exists and it is also not permitted to copy or to watch except to termux root folder so it is not included (if you include this folder it may also backup the whole termux data).

  • /sdcard folder is not included cause it is internal storage of android, trying to backup may cause a storage issue.

    • That's all now wait until the process gets finished and you have your backup

Restore

Resorting backup include checking for some things to check Here are they

  1. You need to make sure proot-distro is installed
  2. check if the distro plugin of your specific distribution exists
    • For example if you have hippo then the file hippo.sh should exist at /data/data/com.termux/files/usr/etc/proot-distro/

  1. check installation directory i.e(/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/<distro_name>)
    • if not make it with mkdir -pv /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/hippo

if you done checking them, then its time to restore

proot --link2symlink tar -xvpzf /sdcard/hippo.tar.gz -C /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/hippo