One of the most significant features of the ZFS filesystem is scrubbing. This is where the filesystem checks itself for errors and attempts to heal any errors that it finds. It’s generally a good idea to scrub consumer-grade drives once a week, and enterprise-grade drives once a month.
How long the scrub takes depends on how much data is in your pool; ZFS only scrubs sectors where data is present so if your pool is mostly empty it will be finished fairly quickly. Time taken is also dependent on drive and pool performance; an SSD pool will scrub much more quickly than a spinning disk pool!
To scrub, run the following command:
# zpool scrub [poolname]
Replace [poolname] with the name of your pool. You can check the status of your scrub via:
# zpool status
The output will look something like this:
scan: scrub in progress since Tue Sep 18 21:14:37 2012
1.18G scanned out of 67.4G at 403M/s, 0h2m to go
0 repaired, 1.75% done
NAME STATE READ WRITE CKSUM
seleucus ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sdh ONLINE 0 0 0
sdk ONLINE 0 0 0
errors: No known data errors
Scrubbing has a low priority so if the drives are being accessed while the scrub is happening there should be less impact on performance. It’s a good idea to automate the scrubbing process in case you forget – we will do a later post on just how to do that!