====== Example for using rsnapshot-zfs-helper with rsnapshot-backup ====== **CAVEAT : WORK IN PROGRESS** ==== preface ==== I'm using ''rsnapshot-backup'' which is basically a wrapper around rsnapshot. It uses one setup per system to backup with one config, exclude and script file. There are also individual backup and logging directories. There is a scheduler which parallelizes backup runs and a configuration frontend using template files to create the backup jobs. There is also an enabling mechnism using symlinks. A typical backup job configuration (created with ''rsnapshot-backup-conf'') consists of: /etc/rsnapshot-backup.d/conf. /etc/rsnapshot-backup.d/exclude. /etc/rsnapshot-backup.d/script. # optional /etc/rsnapshot-backup.d/enabled/conf. -> ../conf. /backup/hosts//daily.0/ /backup/hosts//zfs-snapshots -> daily.0/.zfs/snapshot /var/log/rsnapshot-backup// /backup/hosts/ # ZFS filesystem mounted on /backup/hosts//daily.0/ This example has been created using Debian 9.3 . ==== Setup ==== Inside ''/etc/rsnapshot-backup.d/conf.template'': cmd_cp /bin/true cmd_preexec /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf. preexec cmd_postexec /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf. postexec **Do NOT replace '''''' in the section above!** (It's a placeholder used by the template engine.) Inside ''/etc/rsnapshot-backup.d/conf'': storage_backend=zfs_snapshots zfs_helper=/usr/sbin/rsnapshot-zfs-helper zfs_zpool= zfs_dataset_prefix=backup/hosts/ ** No leading slash - but a trailing one! ** To create a backup job run: rsnapshot-backup-conf ssh-copy-id rsnasphot-backup-enable ==== Details ==== This is what ''rsnapshot-backup-conf'' takes care of: The template mechanism creates: /etc/rsnapshot-backup.d/conf. /etc/rsnapshot-backup.d/exclude. /etc/rsnapshot-backup.d/script. # optional /etc/rsnapshot-backup.d/enabled/conf. -> ../conf. /backup/hosts//daily.0/ /backup/hosts//zfs-snapshots -> daily.0/.zfs/snapshot /var/log/rsnapshot-backup// /backup/hosts/ # ZFS filesystem mounted on /backup/hosts//daily.0/ The zfs filesystem dataset is created: zfs create /backup/hosts/ -o compression=lz4 -o snapdir=hidden -o xattr=sa -o acltype=posixacl -o mountpoint=/backup/hosts//daily.0 rsnapshot-zfs-helper is to be configured inside rsnapshot's configuration files. i.e. '''/etc/rsnapshot-backup.d/conf.''' Additionally, '''cmd_cp''' has to be set to '''/bin/true''' - so the "cp -al ..." is rendered harmless: cmd_cp /bin/true cmd_preexec /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf. preexec cmd_postexec /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf. postexec ''rsnapshot-backup'' itself handles the promotion of the backup's rotation to the subsequent rotation levels.