From OpenZFS on OS X
Jump to: navigation, search

In case you have a degraded pool due to corrupted data on one drive, zpool status will show something like this:

$ sudo zpool status
  pool: tank
 state: DEGRADED
status: One or more devices could not be used because the label is missing or
        invalid.  Sufficient replicas exist for the pool to continue
        functioning in a degraded state.
action: Replace the device using 'zpool replace'.
  scan: none requested
        NAME                     STATE     READ WRITE CKSUM
        tank                     DEGRADED     0     0     0
          raidz1-0               DEGRADED     0     0     0
            disk2                ONLINE       0     0     0
            disk1                ONLINE       0     0     0
            2735026605872377559  FAULTED      0     0     0  was /dev/disk3
            disk4                ONLINE       0     0     0
errors: No known data errors

Now, look into Disk Utility and find the disk number of the disk which is missing. (In our case disk3). If you are certain that the corrupted data was not due to a bad disk, (for example if just the labels were messed up), we can reuse the same disk. First, delete the partition table of that disk.

sudo gpt destroy disk3

Replace the missing device in the pool with this disk.

sudo zpool replace -f tank 2735026605872377559 /dev/disk3

The number you see is the one which you saw above at the position of the faulted drive in sudo zpool status.

The system now starts resilvering the drive. This takes a long time. With sudo zpool status you can see the progress.