Rsnapshot tutorial on how to do Archiving of snapshots

Rsnapshot tutorial on how to do Archiving of snapshots

What is Rsnapshot?

From the official website: “rsnapshot is a filesystem snapshot utility based on rsync. rsnapshot makes it easy to make periodic snapshots of local machines, and remote machines over ssh. The code makes extensive use of hard links whenever possible, to greatly reduce the disk space required”.

Setup Rsnapshot

cp /usr/share/doc/rsnapshot/examples/utils/rsnaptar /usr/local/bin/

Make sure your backup scripts are owned by root, and not writable by anyone else.

chown root.root /usr/local/bin/rsnaptar
chmod o-w /usr/local/bin/rsnaptar

edit script and set directory paths

nano /usr/local/bin/rsnaptar

set TAR_DIR to path where snapshot will be archived, and SNAPSHOT_DIR to where the daily snapshot is located

TAR_DIR="/home/user/dvd_backup"
SNAPSHOT_DIR="/var/cache/rsnapshot/daily.0"

please note that the hourly cycle needs to complete in order for the daily snapshot to be created.

This script supports gpg encrupting of files, to disable it comment out following fline in /usr/local/bin/rsnaptar

GPG=”/usr/bin/gpg”

Scheduling execution via cron

nano /etc/cron.daily/rsnaptar

add

#!/usr/bin/env bash
/usr/local/bin/rsnaptar [email protected]

Notes:

  • this howto does not use the GPG option to encrypt files, if this is a necessity than I can update the howto to include file encryption for better security,
  • by default script is run standalone, but it could be modified to run as a backup_script via rsnapshot itself,
  • https://rsnapshot.org/
Rating: