Skip to content

3) Backups

Tyler Nijmeh edited this page Jul 23, 2020 · 4 revisions

Option A) Local Backup

This backup option is ideal for users who don't plan on migrating their backup to another device.

ChArch includes a built-in rootfs clone command: cparch. Type cparch rootfs <backup-name> (replace rootfs with the name of your rootfs instance if you would like to specify a different one). This will take a long time.

Your final backup should be in the same chroot container folder as your original rootfs instance. You can get the full path with lsarch.

To restore your backup later, remove your broken instance with rmarch, then run cparch <backup-name> rootfs to recreate your rootfs instance from the backup.

If you're sure you won't need your backup again, then type rmarch -n <backup-name> to erase it.

Option B) External Backup

This backup option is ideal for users planning on resetting their host system, or migrating a rootfs instance to a new device.

The first step is to unmount your target rootfs instance: unarch. Then you should use your host's tar command to create a new rootfs tarball. For example: tar cvpzf rootfs.tar.gz /home/chroot/rootfs/ (on Android devices, the default rootfs instance directory is /data/local/chroot/rootfs/). Copy the newly created rootfs.tar.gz to a safe location.

To restore the backup rootfs tarball, copy it to /home/chroot/rootfs.tar.gz, overwriting the existing tarball if necessary. Then, type charch, which will create a new rootfs instance from the backup rootfs tarball.

Option C) Live Backup

This backup option is ideal for users who are in the same situation as Option B, but lack a proper tar command on the host system.

This backup option takes place inside the rootfs instance itself. If you are not already, enter the rootfs instance with charch. Then type the following command to create a backup:

tar cvpzf rootfs.tar.gz --exclude=/dev --exclude=/proc --exclude=/tmp --exclude=/sys --exclude=/rootfs.tar.gz /

The backup will most likely be in the root directory of your rootfs instance. Exit your rootfs instance, type unarch to unmount it, then copy /home/chroot/rootfs/rootfs.tar.gz to a safe place. Then proceed with the steps in Option B.

Clone this wiki locally