How to attach a 2-device striped mirror to a pool?
Solution 1:
This can not be directly done via ZFS. From the man page:
Virtual devices cannot be nested, so a mirror or raidz virtual device can only contain files or disks. Mirrors of mirrors (or other combinations) are not allowed.
My suggestion is to create a new pool comprising the two 1 TB disks and use something as syncoid to frequently send the first pool's content to the new pool.
--- WARNING: clunky workaround below! Do NOT use if not REALLY sure!!! ---
Anyway, if you really want to add the two 1 TB disks as a mirror of the first 2 TB disks, a workaround can be tried. You can use device-mapper (in its LVM form) to concatenate the two disks and attach the resulting volume to the 2 TB device. For example:
pvcreate /dev/sdb
pvcreate /dev/sdc
vgcreate zvg /dev/sdb
vgextend zvg /dev/sdc
lvcreate zvg --name zdev -l +100%FREE
zpool attach tank /dev/sda /dev/zvg/zdev
zpool status
You can achieve a similar (even better) result with mdadm, creating a RAID0 device and attaching it to the zpool:
mdadm --create md127 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
zpool attach tank /dev/sda /dev/md127
zpool status
This approach is not recommended. Use it at your own risk.
Solution 2:
To add the two new disks to the pool, you can use zpool add tank mirror sdb sdc
but this will add the new pair as a mirror, and stripe it with the existing disk. (This doesn't add any redundancy).
You would need to use the zpool attach
command to append the disks to the existing vdev, but you can't use a mirrored-pair to back a single disk, you would have to add a new 2TB disk to make it a mirrored pair.