Adding a mirror to a device in a ZFS pool


In one of my previous posts, I discussed how to add a disk to a ZFS pool. One thing I failed to mention was the fact that adding a device in this manner creates a second stripe in the pool, which adds no redundancy (in that specific example, I was using hardware RAID). Instead of using the zfs “add” command to add a second stripe to the pool, I could have instead used the “attach” option to create a two way mirror from the existing device:

$ zpool attach system c1d0s0 c2d0s0

The attach operation will cause a new top level “mirror” vdev (virtual device) to be created, and both devices will then be associated with that vdev. Once the attach completes, the first device will be synced to the second device. You can monitor the synchronization progress with the zpool utility:

$ zpool status -v

pool: system
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scrub: resilver in progress, 3.13% done, 0h15m to go
config:

NAME STATE READ WRITE CKSUM
system ONLINE 0 0 0
mirror ONLINE 0 0 0
c1d0s0 ONLINE 0 0 0
c2d0s0 ONLINE 0 0 0

The more I work with ZFS, the more I dig it!

This article was posted by Matty on 2007-01-04 14:47:00 -0400 -0400