I used to use rsync to do my backups.
For incremental backups I’ve tried linux-cli-rdiff-backup and linux-cli-duplicity, borg and linux-cli-rsnapshot… and now I use rsnapshot for my daily/weekly/monthly full-disk backup needs and borg for individual directories.
I have two main disks in my laptop, both are encrypted with LUKS as is the backup drive.
Using rsync
Backup all the things
sudo rsync -avhP --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/media/*","/mnt/backup/*","*lost+found*"} --exclude-from=$HOME/.config/rsync/excludes.txt / /mnt/backup/e490
Backup Home
sudo rsync -avxzhPn --exclude-from="$HOME/.config/rsync/exclude" --delete --delete-excluded --backup-dir=/mnt/backup/e490_rsync/home_deleted_files/ $HOME/ /mnt/backup/e490_rsync/home/
Backup Tbcrypt
sudo rsync -avxzhPn --exclude-from="$HOME/.config/rsync/exclude" --delete --delete-excluded --backup-dir=/mnt/backup/e490_rsync/tbcrypt_deleted_files/ /mnt/tbcrypt/ /mnt/backup/e490_rsync/tbcrypt/
Using rsnapshot
rsnapshot uses hardlinks to save disk space and only actually copies new or modified files. Removing the oldest snapshot usually takes the longest.
cryptsetup open $DISK backup -d $SECRET
sudo mount /dev/mapper/backup
sudo rsnapshot -c /etc/rsnapshot.conf -t daily
# The test should output something like this, you can then remove the t flag:
# echo 574006 > /var/run/rsnapshot.pid
# /usr/bin/rm -rf /mnt/backup/daily.6/
# mv /mnt/backup/daily.5/ /mnt/backup/daily.6/
# [...]
# mv /mnt/backup/daily.0/ /mnt/backup/daily.1/
# /usr/bin/rsync -avhP --delete --numeric-ids --relative --delete-excluded \
--exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* \
--exclude=/run/* --exclude=/media/* --exclude=/mnt/backup/* \
--exclude=*lost+found* \
--exclude-from=/home/lukel/.config/rsync/excludes.txt \
--filter=-/_/mnt/backup --link-dest=/mnt/backup/daily.1/e490/ / \
/mnt/backup/daily.0/e490/
# touch /mnt/backup/daily.0/
sync
umount /mnt/backup
cryptsetup close backup
udiskctl power-off -b $DISK
- Keywords: tech