Warning: Invalid argument supplied for foreach() in /home/techrecipes/public_html/wp-content/themes/techrecipes/header.php on line 77

ZFS: How to fsck or Check Filesystem Integrity with scrub

ZFS will change the way UNIX people think about filesystems. How do you use fsck with a ZFS filesystem? The answer is that you do not. ZFS filesystems are always clean, so even in the worst case of a power outage bringing a system down, you will never be asked to give the root password for system maintenance again. With ZFS, data are always consistent on disk. For you worriers, there is a command you can use to make sure everything is okay with your filesystems.


Unlike of the fsck command which had to be run on an unmounted filesystem (read: downtime), the zpool command has a scrub option which works on a mounted, living filesystem. When run, the command checks all data in the pool for checksum consistency. On redundant systems (raidz or mirror), inconsistencies will be repaired.

To scrub the pool techrx, use the following:

zpool scrub techrx

The command creates lots of IO, so use it judiciously. Only one scrub session is permitted at a time. To stop scrubbing a pool, use the -s option:

zpool scrub -s techrx

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.

  • Spamx

    thanks – very useful!