ZFS: Adding a new mirror to an existing ZFS pool

  Mirrored vdevs are great for performance and it is quite straight-forward to add a mirrored vdev to an existing pool (presumably one with one or more similar vdevs already):  
zpool add [poolname] mirror [device01] [device02] [device03]
  If it’s a two-way mirror you will only have two devices in the above. An example for ZFS on Ubuntu with a pool named seleucus and two SSDs could look like:  
zpool add seleucus mirror ata-SAMSUNG_SSD_830_Series_S0XYNEAC705640 ata-M4-CT128M4SSD2_000000001221090B7BF9
  As always, it’s good practice to use the device name found in /dev/disk/by-id/ rather than the sda, sdb, sdc etc. names as the latter can change – the former do not.

How to add a drive to a ZFS mirror

Sometimes you may wish to expand a two-way mirror to a three-way mirror, or to make a basic single drive vdev into a mirror – to do this we use the zpool attach command. Simpy run:  
# zpool attach [poolname] [original drive to be mirrored] [new drive]
An example:  
# zpool attach seleucus /dev/sdj /dev/sdm
  …where the pool is named seleucus, the drive that’s already present in the pool is /dev/sdj and the new drive that’s being added is /dev/sdm. You can add the force switch like so:  
# zpool attach -f seleucus /dev/sdj /dev/sdm  
to force ZFS to add a device it thinks is in use; this won’t always work depending on the reason why the drive is showing up as being in use.   Please note that you cannot expand a raidz, raidz1, raidz2 etc. vdev with this command – it only works for basic vdevs or mirrors. The above drive syntax is for Ubuntu; for Solaris or OpenIndiana the drive designations look like c1t0d0 instead, so the command might look like:  
# zpool attach seleucus c1t1d0 c1t2d0  
…instead.   This is a handy command if you want a three-way mirror but don’t have all three drives to start with – you can get the ball rolling with a 2-way mirror and add the third drive down the track. Remember that ZFS performs reads in a mirror in round-robin fashion, so that while you get a single drive’s performance for writes you will get approximately the sum of all of the drives in terms of read performance – it’s not hard for a 3-way 6gb/s SSD mirror to crack 1,500MB/s in sequential reads. It’s a fantastic way to get extreme performance for a large number of small VMs.  


asian single ladies
I was asked how to add a disk into a ZFS mirror today; this is an easy one:   # zpool attach [poolname] [existing disk] [new disk]   …and done! The pool will begin to resilver with the new disk as part of the existing mirror. You might want to do this to replace a part of the mirror which has been removed or is faulty, or you might want to expand a 2-way mirror to a 3-way mirror (longer MTBF forĀ  the 3-way, beyond that it’s not worth it).