Date: Thu, 1 Aug 2019 09:29:26 -0700 From: David Christensen <dpchrist@holgerdanske.com> To: freebsd-questions@freebsd.org Subject: zfstools zfs-auto-snapshot "KEEP" argument issue Message-ID: <7d828758-faeb-4afa-766d-4f1fe1cae635@holgerdanske.com>
next in thread | raw e-mail | index | archive | help
freebsd-questions:
Same machine as previous post, but with com.sun:auto-snapshot property
case-sensitivity fixed:
2019-08-01 09:14:24 toor@soho ~
# zfs get -t filesystem com.sun:auto-snapshot | head
NAME PROPERTY
VALUE SOURCE
bootpool com.sun:auto-snapshot
true local
soho_zroot com.sun:auto-snapshot
true local
soho_zroot/ROOT com.sun:auto-snapshot
true inherited from soho_zroot
soho_zroot/ROOT/default com.sun:auto-snapshot
true inherited from soho_zroot
soho_zroot/tmp com.sun:auto-snapshot
true inherited from soho_zroot
soho_zroot/usr com.sun:auto-snapshot
true inherited from soho_zroot
soho_zroot/usr/home com.sun:auto-snapshot
true inherited from soho_zroot
soho_zroot/usr/ports com.sun:auto-snapshot
true inherited from soho_zroot
soho_zroot/usr/src com.sun:auto-snapshot
true inherited from soho_zroot
zfs-auto-snapshot accepts two arguments -- INTERVAL and KEEP:
2019-08-01 09:17:49 toor@soho ~
# zfs-auto-snapshot
Usage: /usr/local/sbin/zfs-auto-snapshot [-dknpuv] <INTERVAL> <KEEP>
-d Show debug output.
-k Keep zero-sized snapshots.
-n Do a dry-run. Nothing is committed. Only show what
would be done.
-p Create snapshots in parallel.
-P pool Act only on the specified pool.
-u Use UTC for snapshots.
-v Show what is being done.
INTERVAL The interval to snapshot.
KEEP How many snapshots to keep.
Creating a snapshot with INTERVAL=foo works:
2019-08-01 09:11:22 toor@soho ~
# zfs-auto-snapshot foo 9
2019-08-01 09:13:23 toor@soho ~
# ls -l /bootpool/.zfs/snapshot/ | grep foo
drwxr-xr-x 3 root wheel 3 May 23 22:21 zfs-auto-snap_foo-2019-08-01-09h13
But if I wait a minute and do another run, KEEP=9 is not honored
(previous snapshot is removed, when it should have been kept):
2019-08-01 09:13:38 toor@soho ~
# zfs-auto-snapshot foo 9
2019-08-01 09:14:21 toor@soho ~
# ls -l /bootpool/.zfs/snapshot/ | grep foo
drwxr-xr-x 3 root wheel 3 May 23 22:21 zfs-auto-snap_foo-2019-08-01-09h14
Also fails with single quotes:
2019-08-01 09:19:46 toor@soho ~
# zfs-auto-snapshot 'foo' '9'
2019-08-01 09:24:05 toor@soho ~
# ls -l /bootpool/.zfs/snapshot/ | grep foo
drwxr-xr-x 3 root wheel 3 May 23 22:21 zfs-auto-snap_foo-2019-08-01-09h24
Any ideas?
David
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d828758-faeb-4afa-766d-4f1fe1cae635>
