ZFS: Stopping a scrub

If you accidentally started a scrub on a pool or need to stop one for any reason it’s fortunately quite straightforward:  
# zpool scrub -s [poolname]  
  e.g. zpool scrub -s kepler   You can check on whether that was successful with zpool status – it will give an output above the pool status that looks like:   pool: kepler state: ONLINE scan: scrub canceled on Sat Sep 29 10:30:14 2012   Unnecessary scrubbing just wastes power – particularly for a large, nearly-full array where you’ll have quite a few disks running constantly for hours – so it’s good practice to cancel an accidentally-started scrub.

ZFS Basics – zpool scrubbing

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:  
pool: seleucus state: ONLINE 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 config: 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!