From owner-freebsd-questions@freebsd.org Thu Aug 1 16:29:30 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8080C1EF9 for ; Thu, 1 Aug 2019 16:29:30 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [184.105.128.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "holgerdanske.com", Issuer "holgerdanske.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 45zwjj4zkVz3Pc9 for ; Thu, 1 Aug 2019 16:29:29 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from 99.100.19.101 ([99.100.19.101]) by holgerdanske.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Thu, 1 Aug 2019 09:29:26 -0700 To: freebsd-questions@freebsd.org From: David Christensen Subject: zfstools zfs-auto-snapshot "KEEP" argument issue Message-ID: <7d828758-faeb-4afa-766d-4f1fe1cae635@holgerdanske.com> Date: Thu, 1 Aug 2019 09:29:26 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 45zwjj4zkVz3Pc9 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of dpchrist@holgerdanske.com has no SPF policy when checking 184.105.128.27) smtp.mailfrom=dpchrist@holgerdanske.com X-Spamd-Result: default: False [0.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE(-0.40)[ipnet: 184.104.0.0/15(0.85), asn: 6939(-2.79), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[holgerdanske.com]; RCVD_IN_DNSWL_NONE(0.00)[27.128.105.184.list.dnswl.org : 127.0.10.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:184.104.0.0/15, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2019 16:29:30 -0000 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] -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