From owner-freebsd-stable@FreeBSD.ORG Sun May 30 02:42:45 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 C6F2F1065670 for ; Sun, 30 May 2010 02:42:45 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 73E848FC0C for ; Sun, 30 May 2010 02:42:45 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o4U2gfBD018604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 29 May 2010 21:42:42 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id o4U2gfdG044134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 29 May 2010 21:42:41 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o4U2gf33044133; Sat, 29 May 2010 21:42:41 -0500 (CDT) (envelope-from dan) Date: Sat, 29 May 2010 21:42:41 -0500 From: Dan Nelson To: Kirk Strauser Message-ID: <20100530024240.GE8866@dan.emsphone.com> References: <4C017419.9010909@strauser.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C017419.9010909@strauser.com> X-OS: FreeBSD 8.0-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Sat, 29 May 2010 21:42:42 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: FreeBSD-STABLE Mailing List 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: Sun, 30 May 2010 02:42:45 -0000 In the last episode (May 29), Kirk Strauser said: > I found some nice scripts to regularly snapshot all the filesystems in my > ZFS pool at > http://www.neces.com/blog/technology/integrating-freebsd-zfs-and-periodic-snapshots-and-scrubs > . One thing bothers me, though: I have to intentionally set how many > months' worth of snapshots I want to keep. Too many and I run out of > room. Too few and I lose some of the benefits of easy recovery of > deleted data. My computer is better at bookkeeping than I am, so why not > let it? > > I'd propose standardizing on an attribute like > org.freebsd:allowautodestroy. Modify ZFS's disk full behavior to scan for > snapshots with that attribute set and destroy the oldest one, and continue > until there's enough free space to complete a write requests or until out > of "expendable" snapshots to destroy (at which time the normal disk full > handler would run). Also run a daily periodic script to ensure that the > free space stays below a configurable threshold each day so that ZFS isn't > constantly butting up against completely full drives. If the kernel does the snapshot deleting itself, why not add a pool-level property that sets the amount of free space at which the deletion starts? That way you don't need the cleanup script. Alternatively, make the org.freebsd:allowautodestroy property hold the trigger freespace amount. That way you can have monthly/daily/hourly snapshots but set it so the hourly ones disappear first, then the dailies (by setting the destroy trigger slightly higher for the ones you want to expire first). -- Dan Nelson dnelson@allantgroup.com