zfsonlinux/debian/tree/zfsutils-linux/usr/lib/zfs-linux/scrub

13 lines
282 B
Plaintext
Raw Normal View History

#!/bin/sh -eu
# Scrub all healthy pools that are not already scrubbing.
zpool list -H -o health,name 2>&1 | \
awk 'BEGIN {FS="\t"} {if ($1 ~ /^ONLINE/) print $2}' | \
while read pool
do
if ! zpool status "$pool" | grep -q "scrub in progress"
then
zpool scrub "$pool"
fi
done