System-tar-and-restore
System-tar-and-restore contains two bash scripts, backup.sh and restore.sh. The former makes a tar backup of your system. The latter restores the backup or transfers your system using rsync in desired partition(s). The scripts include two interfaces, cli and dialog (ncurses). If you plan to use the second, install dialog from the official repositories.
Installation
Install system-tar-and-restoreAUR from the AUR or from archlinuxgr-any repo.
Features
- Full or partial backup
- Restore or transfer to the same or different disk/partition layout.
- Restore or transfer to an external device such as usb flash drive, sd card etc.
- Restore a BIOS-based system to UEFI and vice versa.
- Prepare a system in a virtual machine (such as virtualbox), back it up and restore it in a normal machine.
Backup
The backup.sh script makes a tar backup of your system. You will be asked for:
- Destination directory: Where you want to save the backup. Default is
/
. - Archive name: A desired name for the backup. Default is
Backup-$(hostname)-$(date +%d-%m-%Y-%T)
. - /home directory options: You have three options: fully include it, keep only it's hidden files and folders (which are necessary to login and keep basic settings) or completely exclude it (in case it's located in separate partition and you want to use that in restore).
- Compression: You can choose between gzip, bzip2, xz and none (for no compression). Gzip should be fine.
- Archiver options: You can pass your own extra options in the archiver. See
tar --help
for more info. - Passphrase and encryption method: Enter a passphrase if you want to encrypt the archive and select encryption method (openssl or gpg). Leave empty for no encryption.
You can review all your settings in the summary and also view the supported bootloaders found on your system (grub and syslinux).
Also you can set all the options in /etc/backup.conf
. Copy from the sample file /usr/share/system-tar-and-restore/backup.conf
and edit it to your needs.
All options can also be passed using arguments. See backup.sh --help
, man system-tar-and-restore
or here.
When the process completes, you may want to check backup.log
file in the same directory with the backup archive.
Restore/Transfer
The restore.sh script has two modes: Restore and Transfer. The first uses the above created archive to extract it in desired partition(s). The second transfers your system in desired partition(s) using rsync. Then, in both cases, generates the target system's fstab, rebuilds initramfs for every available kernel, generates locales and finally installs and configures the selected bootloader.
Boot from a livecd (preferably an Arch Linux based) or another system, prepare your target partition(s) and start the script. You will be asked for:
- Target partitions: You must specify at least one target root partition and in case of UEFI a target ESP partition. Optionally you can choose any other partition for your /home, /boot, swap or custom mount points (/var /opt etc.)
- Mount options: You can specify alternative comma-seperated mount options for the target root partition. Defaults are
defaults,noatime
. -
Btrfs subvolumes: If the target root filesystem is Btrfs, you will be prompted for root subvolume name. Leave empty if you dont want subvolumes. Also you can specify other subvolumes. Just enter the paths (/home /var /usr etc.) seperated by space. Recommended root subvolume name is
__active
. - Bootloader: You can choose grub or syslinux, the target disk and in case of syslinux any additional kernel options that will be written in the target syslinux.cfg.
- Select mode: In Restore mode you have to specify the backup archive location, local or remote (you will need wget). If the archive is encrypted you will be prompted for the passphrase. In Transfer mode you will have to specify if you want to transfer your entire /home directory or only it's hidden files and folders (which are necessary to login and keep basic settings).
- Tar/Rsync options: You may want to specify any additional options. See
tar --help
orrsync --help
for more info.
You can review all your settings in the summary.
All options can also be passed using arguments. See restore.sh --help
, man system-tar-and-restore
or here.
When the process completes, you may want to check /tmp/restore.log
.