Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2010 11:46:52 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Alexander Leidinger <Alexander@Leidinger.net>
Cc:        fs@freebsd.org
Subject:   Re: CFT: periodic scrubbing of ZFS pools
Message-ID:  <20100613094652.GC1320@garage.freebsd.pl>
In-Reply-To: <20100610162629.38992mazf0sfdqg0@webmail.leidinger.net>
References:  <20100610162629.38992mazf0sfdqg0@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--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"<number_of_days>" # default: 30
>  daily_scrub_zfs_<POOLNAME>_threshold=3D"<number_of_days>"
>=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 <pool>'.
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100613094652.GC1320>