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
[-- Attachment #1 --] On Thu, Jun 10, 2010 at 04:26:29PM +0200, Alexander Leidinger wrote: > Hi, > > as there seems to be interest in a periodic script to scrub zpools, I > modified my monthly-POC into a daily script with parameters for which > pools to scrub, how many days between scrubs (even different per pool, > if required), and several error checks (non-existing pool specified, > scrub in progress). > > You can find it at > http://www.Leidinger.net/FreeBSD/current-patches/600.scrub-zfs > > Please put it into /etc/periodic/daily and test it. Possible > periodic.conf variables are: > daily_scrub_zfs_enable="YES" > daily_scrub_zfs_pools="name1 name2 name3" # all if unset or empty > daily scrub_zfs_default_threshold="<number_of_days>" # default: 30 > daily_scrub_zfs_<POOLNAME>_threshold="<number_of_days>" > > If there is no specific threshold for a pool (= days between scrubs), > the default threshold is used. Patch looks good. The only minor issue I found is that in: _last_scrub=$(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. -- Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkwUqQwACgkQForvXbEpPzTvuACfSsFubrO5blWrHiOWKBfzU+iR 9wgAoJ7pXLwDJ9BRdGWWM+bU9lcgzQdS =XiCJ -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100613094652.GC1320>
