Rsync: Backup hard linked incrementals

By admin, 2 April, 2020

For quite some years I've been using an rsync script to make my backups. You can find it here. It basically makes an incremental daily backup and uses hardlinks for files that have not changed to preserve diskspace.

Howto use it

The basic syntax for is: <hostname> <remote_root_path> <backup_path>

Locate some server you have and make a new directory on the volume you wish to use for backups. In my examples we will be using /backup.

  • Move the script to /backup/
  • Add a file named /backup/backup.exclude which states all paths that should be skipped when running a backup (e.g. /sys, /dev, /proc)
  • Make a new folder for every machine you want to backup (I suggest using hostnames)
  • Add a new folder in every machine folder called seed (This is used for the initial incremental, after the first backup has been run it can be removed)
  • Add a new script /backup/ which contains something like this:

    if [ -e /backup/ ]; then
     /backup/ /opt /backup/
     /backup/ / /backup/
     echo " does not exist"


  • Generate a ssh key for the root user on your backup machine.
  • Deploy the ssh key to all machine that have to be backupped (for the root user). I suggest using ssh-copy-id.
  • Run /backup/ to start initial backups (this might take a while)
  • Add a cronjob to run /backup/ on a daily basis.
  • Profit

At the moment there is no cleanup in the script, so you manually have to check if there is still enough disk space available for new backups.




Drupal 10 Appliance - Powered by TurnKey Linux