Description
When I run the following command, snapshots are created on all datasets (not just the one I specified), but the --dry-run argument is given:
zfs-auto-snapshot -sq -k 120 -l "min" -r --dry-run h
Based on the --help text, I expect this code will not create any snapshots at all because --dry-run is specified. If --dry-run was not specified, I would expect it to create recursive snapshots of dataset "h" with the "min" label. Instead, it creates recursive snapshots on ALL datasets (not just "h") with the "frequent" label. I am running debian stretch using zfs-auto-snapshot 1.2.1-1+deb9u1 from the debian repo (installed with apt install zfs-auto-snapshot
).
This is a bug and is a nuisance to clean up. I used the following code in the shell to clean up the mess it made:
zsnaps_extra="$(zfs list -t snapshot | grep "frequent" | awk '{print $1}')"
nsnaps_extra="$(echo "$zsnaps_extra" | grep -c "")"
for j in `seq 1 $nsnaps_extra` ; do
snaptodel="$(printf '%s\n' "$zsnaps_extra" | head -n $j | tail -n 1 )"
/sbin/zfs destroy -rpv "$snaptodel"
done