From owner-freebsd-stable@FreeBSD.ORG Mon May 31 00:40:05 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E595106566B for ; Mon, 31 May 2010 00:40:05 +0000 (UTC) (envelope-from kirk@strauser.com) Received: from kanga.honeypot.net (kanga.honeypot.net [IPv6:2001:470:a80a:1:21f:d0ff:fe22:b8a8]) by mx1.freebsd.org (Postfix) with ESMTP id BB5C58FC08 for ; Mon, 31 May 2010 00:40:04 +0000 (UTC) Received: from kanga.honeypot.net (localhost [127.0.0.1]) by kanga.honeypot.net (Postfix) with ESMTP id 91BF87C5D4; Sun, 30 May 2010 19:40:03 -0500 (CDT) X-Virus-Scanned: amavisd-new at honeypot.net Received: from kanga.honeypot.net ([127.0.0.1]) by kanga.honeypot.net (kanga.honeypot.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rS1UrRTxwcfk; Sun, 30 May 2010 19:40:01 -0500 (CDT) Received: from pooh.honeypot.net (pooh.honeypot.net [IPv6:2001:470:a80a:1:20a:95ff:fed5:10f2]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by kanga.honeypot.net (Postfix) with ESMTPSA id 04CCB7C5CF; Sun, 30 May 2010 19:40:01 -0500 (CDT) Message-Id: <613D3C80-85F6-4A52-8C33-7F5AF18A3A2E@strauser.com> From: Kirk Strauser To: Christof Schulze In-Reply-To: <201005310234.47363.christof.schulze@gmx.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Sun, 30 May 2010 19:40:00 -0500 References: <4C017419.9010909@strauser.com> <4F444333-C839-4C2F-AA5D-1898192DDE93@strauser.com> <201005310208.22387.christof.schulze@gmx.com> <201005310234.47363.christof.schulze@gmx.com> X-Mailer: Apple Mail (2.936) Cc: freebsd-stable@freebsd.org Subject: Re: Make ZFS auto-destroy snapshots when the out of space? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 00:40:05 -0000 On May 30, 2010, at 7:34 PM, Christof Schulze wrote: > still struggling with the attachment remover. So here is the script: > > http://paste.pocoo.org/show/220207/ That's pretty similar in concept to the scripts I found and am using, but with the difference that those scripts use "zfs snapshot -r" to take a recursive, atomic snapshot of all filesystems in the configured pools. I wrote a separate script to prune all the unwanted filesystems (/tmp, and so on) regularly: #!/bin/sh # If there is a global system configuration file, suck it in. # if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf source_periodic_confs fi filesystems=$hourly_zfs_snapshot_prune_filesystems case "$hourly_zfs_snapshot_prune_enable" in [Yy][Ee][Ss]) if [ -z "$filesystems" ]; then echo "Hourly snapshot pruning is enabled but not configured." exit 2 fi for filesystem in $filesystems ; do zfs list -H -o name -t snapshot | grep -E "^ $filesystem@(hourly|daily|weekly|monthly)" | xargs -n1 zfs destroy done ;; *) ;; esac -- Kirk Strauser