Rsync

Rattail can invoke the rsync command to copy relevant portions of the file system to another location.

The main disadvantage to rsync is that the “backup” is competely replaced every time the command runs. So you always have just one “most recent” backup.

Doing so is almost certainly better than nothing, but Borg is really a superior solution in every way it seems. You are encouraged to use that instead.

Configuration

You can enable the rsync feature like so:

[rattail.backup]
rsync = true

The rsync feature is disabled by default but you can make that explicit:

[rattail.backup]
rsync = false

By default Rattail will run rsync before it runs borg create, but you can reverse that sequence if you need to:

[rattail.backup]
rsync.last = true

Destination

Rattail only supports a single “destination” for rsync. This can be either a “local” path, e.g. a backup drive mounted to the main filesystem, or can be a remote path accessible via SSH.

Here is what a “local” path would look like, e.g. if we want rsync to write files in the /mnt/mydrive/server-backup folder:

[rattail.backup]
rsync.remote_prefix = /mnt/mydrive/server-backup

And if we instead wanted rsync to write to the /srv/server-backup folder on the otherserver remote machine:

[rattail.backup]
rsync.remote_host = otherserver
rsync.remote_prefix = /srv/server-backup

Files to Backup

Rattail will by default only include certain folders in the rsync run, and avoid things like the /tmp folder etc. You can override this as needed, but here is the default list of what it includes:

[rattail.backup]
rsync.include =
    /etc
    /home
    /opt
    /root
    /srv
    /usr/local
    /var

Rattail will also exclude some things by default; again override as needed but here is that default list. Note that the convention used is to specify trailing slash for folders, and not for files. These values are passed directly to the rsync command so ultimately it will be interpreting them:

[rattail.backup]
rsync.exclude =
    /var/cache/

Note that it is only necessary to exclude things which fall “within” folders which are included ..e.g. no reason to explicitly exclude the /tmp folder since it wasn’t included. But since /var is included we must exclude /var/cache or else it would be backed up along with the rest.