Backup Solutions under Arch

Publish Date: Oct 6, 2015    Last Update: Jun 28, 2018

What is this post for?

Recently I have spilled coffee over my Thinkpad several times, and that makes me realize the importance of backing up my system. This post serves as a guide to back up the complete Linux system using tar.

Steps for backing up

  1. Boot from a live CD. Personally I keep an arch-linux live CD in a flash drive.

  2. Mount the drives on the computer.

sudo mkdir /mnt/arch/
sudo mount /dev/sda2 /mnt/arch
sudo mount /dev/sda1 /mnt/arch/boot
  1. Chroot into the system. In Arch, use arch-chroot.

  2. Using tar to backup the system

sudo tar --exclude-from=/path/to/exclusion-list \
         --xattrs -czpvf \
         /opt/backup/arch.tar.gz /

The exclusion-list is a text file containing the folders and the files that we want to exclude to keep the backup file compact. My exclusion-list looks like


The backup process can take quite long, depending on the size of the system. After the job completion, the arch.tar.gz file should contains all the necessary files now with attributions preserved.

Steps for Recovering

Recovering is a bit more tricky. General steps are:

  1. Boot from a Live CD

  2. Partition the drive. I use UEFI to boot my system, therefore the appropriate way to partition the drive is to (1) create a 512M drive, formatted as FAT32, and labeled as boot. (2) create the rest of the drive as ext4.

  3. Mount the drives. Similar to the steps above.

  4. Chroot into the system

  5. Extract the arch.tar.gz file to the system.

tar --verbose --xattrs -xpf /media/XX/arch.tar.gz 
  1. Change fstab and /boot. I use GPARTED to get the UUID of the partitions and modify the fstab accordingly. Further one can make sure the boot folder is correctly specified. All these are done with chroot.
cd /mnt/arch/
chroot . /bin/bash

Reboot the system, and everything is back as if never being moved!