I found that none of the daily, hourly, weekly or monthly snapshots were
being taken. When I looked into it I found that the scripts didn't
execute properly, because of the newly introduced check (9c6f065).
I'm not versed enough with POSIX to understand if there was some clever
intention with using exec than just calling which by it self, but it
works without exec so I removed it.
* Currently the following command line:
zfs-auto-snapshot.sh.orig --keep 7 --label daily --prefix '' --sep '-' \
--event "daily-$(date --utc +"%Y%m%d.%H%M")" --recursive --verbose //
will give the following result:
zfs snapshot -o com.sun:auto-snapshot-desc='daily-20150403.0013' \
-r 'share/.Bacula@-daily-2015-04-03-0013'
* If instead 'prefix=daily', this would be the result:
zfs snapshot -o com.sun:auto-snapshot-desc='daily-20150403.0015' \
-r 'share/.Bacula@daily-daily-2015-04-03-0016'
* If 'prefix=daily' and 'label=NULL':
zfs snapshot -o com.sun:auto-snapshot-desc='daily-20150403.0017' \
-r 'share@daily'
This because SNAPNAME is constructed wrongly. Instead, only separate
the 'prefix' from the 'label' with 'sep' if 'prefix' is actually set.
I am working on a complimentary script that does log-shipping style replication to a backup volume for highly efficient incremental backups. This relies on "zfs send -R" and that the sets of snapshots existing on the source and backup destination overlap by at least one snapshot. I plan to use snapshot clones to place a "checkpoint" reservation on a snapshot that will be required for future backups.
In order to keep zfs-auto-snapshot from destroying a snapshot necessary for a future incremental backup replication stream, I will create an unmounted clone of that snapshot, and destroy any prior clones when the backup completes.
Any snapshots destroyed by the zfs-auto-snapshot "zfs destroy -d" will be destroyed as the dependent clones are destroyed. Without the -d option, zfs-auto-snapshot would fail to destroy the old snapshot with a checkpoint clone, and it would persist until later snapshot jobs destroy it in subsequent runs. Since monthlies and weeklies are relatively infrequent, deferred destruction will reap the snapshots opportunistically as soon as the "checkpoint" clones are gone. Intermediate snapshots between the "checkpoint" reserved snapshots and the recent snapshots preserved by the zfs-auto-snapshot.sh will still be immediately destroyed.
Resolve this lintian error:
E: zfs-auto-snapshot: bad-permissions-for-etc-cron.d-script etc/cron.d/zfs-auto-snapshot 0755 != 0644
W: zfs-auto-snapshot: executable-not-elf-or-script etc/cron.d/zfs-auto-snapshot
This should also resolve a related failure on Arch Linux.
Closes: zfsonlinux/zfs-auto-snapshot#4
Thanks: @bitloggerig
Thanks: @scottj97