From owner-freebsd-fs@FreeBSD.ORG Sun Jun 13 09:47:13 2010 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52432106564A for ; Sun, 13 Jun 2010 09:47:13 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello089077043238.chello.pl [89.77.43.238]) by mx1.freebsd.org (Postfix) with ESMTP id 8EF408FC17 for ; Sun, 13 Jun 2010 09:47:11 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id B17C545C9B; Sun, 13 Jun 2010 11:47:09 +0200 (CEST) Received: from localhost (gate.wheel.pl [10.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id F20E945C8A; Sun, 13 Jun 2010 11:47:02 +0200 (CEST) Date: Sun, 13 Jun 2010 11:46:52 +0200 From: Pawel Jakub Dawidek To: Alexander Leidinger Message-ID: <20100613094652.GC1320@garage.freebsd.pl> References: <20100610162629.38992mazf0sfdqg0@webmail.leidinger.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3Pql8miugIZX0722" Content-Disposition: inline In-Reply-To: <20100610162629.38992mazf0sfdqg0@webmail.leidinger.net> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: fs@freebsd.org Subject: Re: CFT: periodic scrubbing of ZFS pools X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2010 09:47:13 -0000 --3Pql8miugIZX0722 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 10, 2010 at 04:26:29PM +0200, Alexander Leidinger wrote: > Hi, >=20 > as there seems to be interest in a periodic script to scrub zpools, I =20 > modified my monthly-POC into a daily script with parameters for which =20 > pools to scrub, how many days between scrubs (even different per pool, = =20 > if required), and several error checks (non-existing pool specified, =20 > scrub in progress). >=20 > You can find it at > http://www.Leidinger.net/FreeBSD/current-patches/600.scrub-zfs >=20 > Please put it into /etc/periodic/daily and test it. Possible =20 > periodic.conf variables are: > daily_scrub_zfs_enable=3D"YES" > daily_scrub_zfs_pools=3D"name1 name2 name3" # all if unset or empty > daily scrub_zfs_default_threshold=3D"" # default: 30 > daily_scrub_zfs__threshold=3D"" >=20 > If there is no specific threshold for a pool (=3D days between scrubs), = =20 > the default threshold is used. Patch looks good. The only minor issue I found is that in: _last_scrub=3D$(zpool history ${pool} | grep scrub | tail -1 |\ cut -d ' ' -f 1) grep is definitely too weak. If there is a pool or even dataset with 'scrub' word in it, it will be confused. Also when someone stops the scrub it will be stored in history as 'zpool scrub -s '. I proposed something like this: egrep '^[0-9\.\:\-]{19} zpool scrub '${pool}'$' Currently there is no way to tell if 'zpool scrub -s' stopped a scrub or if there was no scrub running. In newer versions of ZFS, it has a property which tells when the last scrub finished. Once we update ZFS we could take advantage of it. All in all, with better grep I'd like to see it committed. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --3Pql8miugIZX0722 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkwUqQwACgkQForvXbEpPzTvuACfSsFubrO5blWrHiOWKBfzU+iR 9wgAoJ7pXLwDJ9BRdGWWM+bU9lcgzQdS =XiCJ -----END PGP SIGNATURE----- --3Pql8miugIZX0722--