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

13 lines
282 B
Bash
Raw Normal View History

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