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
Steps for backing up
Boot from a live CD. Personally I keep an arch-linux live CD in a flash drive.
Mount the drives on the computer.
sudo mkdir /mnt/arch/ sudo mount /dev/sda2 /mnt/arch sudo mount /dev/sda1 /mnt/arch/boot
Chroot into the system. In Arch, use
Using tar to backup the system
sudo tar --exclude-from=/path/to/exclusion-list \ --xattrs -czpvf \ /opt/backup/arch.tar.gz /
exclusion-list is a text file containing the folders and the files that
we want to exclude to keep the backup file compact.
exclusion-list looks like
/dev/* /proc/* /sys/* /tmp/* /run/* /mnt/* /media/* /lost+found /var/lock/* /var/run/* /var/log/* /var/lib/docker/* /var/cache/pacman/pkg/* /opt/backup/arch* /home/user/*
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:
Boot from a Live CD
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.
Mount the drives. Similar to the steps above.
Chroot into the system
arch.tar.gzfile to the system.
tar --verbose --xattrs -xpf /media/XX/arch.tar.gz
/boot. I use
GPARTEDto get the UUID of the partitions and modify the
fstabaccordingly. Further one can make sure the
bootfolder 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!