Rsnapshot

This article describes a simple automated backup scheme using the tool rsnapshot, which is based on rsync. rsnapshot makes a specified number of incremental backups of specified file trees, using hard links to save space on the backup medium.

The following backup scheme will rotate the backups on a daily, weekly and monthly basis. That means, it will keep a daily snapshot for 7 days, a weekly snapshot for 4 weeks and a monthly snapshot for 12 month. Furthermore, it uses an extra partition for the backup which will be mounted only for the time of the backup process.

Emerge
Install :

fstab
Assumed the backup partition is labeled backup, formatted with ext4 and it should be mounted on during backup: Add an entry like the following in your fstab:

The  option means that this backup filesystem will not be mounted by default. The backup filesystem would normally be on an external device to be safe in the case of a device failure.

Cron scripts
Create cron scripts for the different backup intervals:

rsnapshot configuration files
Set up the rsnapshot configuration file.

Default rsnapshot config file:

In these files, the second argument of backup specifies a container directory for the backups, usually referring to the machine (in this case, localhost). This can be changed to any name of your choosing. The final snapshots will be saved under

Using rsyncd on a trusted LAN
Following the Home Router Rsync server you can setup a rsync daemon on your source computer with a share like:

On the destination server, which runs rsnapshot, define a backup line in /etc/rsnapshot.conf like:

Pay attention to highly insecure mechanism without password checking or encrypted transfer.

Restoration
To restore the localhost backups specified above, we would use:

where is the mount point of the fresh root filesystem. In the paths above *.0 refers to the latest increment.

Possible improvements
It is also possible to make remote backups via rsync or SSH -- see the rsnapshot man page for details or Advanced_backup_using_rsnaphot

BTRFS snapshots
Those using btrfs can leverage its snapshotting abilities with rsnapshot. Walter Werther has a guide on this.