Great thing about ZFS is that even with a single disk you get some benefits - data integrity being the most important. And all ZFS commands work perfectly well, for example status:
# zpool status
pool: Data.Tertiary
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
Data.Tertiary ONLINE 0 0 0
diskid/DISK-XXX.eli ONLINE 0 0 0
However, what if one disk is not sufficient any more? It is clear zpool add can be used to create striped pool for higher speeds. And it is clear we can add another device to make a three way mirror. But what if we want to convert solo disk to mirror configuration?
Well, in that case we can get creative with attach command giving it both disks as an argument:
# zpool attach Data.Tertiary diskid/DISK-XXX.eli diskid/DISK-YYY.eli
After a few seconds, our mirror is created with all our data intact:
# zpool status
pool: Data.Tertiary
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.
config:
NAME STATE READ WRITE CKSUM
Data.Tertiary ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
diskid/DISK-XXX.eli ONLINE 0 0 0
diskid/DISK-YYY.eli ONLINE 0 0 0 (resilvering)
PS: Yes, I use encrypted disks from /dev/diskid/
as I used them in previous ZFS examples. If you want plain devices, just use ada0
and companions instead.
Thanks, this was the info I was looking for! “zfs add disk to pool as mirror” did find you
When I try this, I get an error saying, “can only attach to mirrors and top-level disks”. The current output of “zpool status” looks just like yours (the first one). Have you seen that?
Did you add pool name (in front of disk name)?
This was great! Lots of what I read on this topic was misleading or complicated. I did think that I needed to use diskid/ as part of my command, but then I realized that that was part of the identifier for your disk. In my case, I did:
ls -l /dev/disk/by-id/
Which gave me my ids, which were ata-WDC_WD181KFGX-68AFPN0_4BHDK1XH and ata-WDC_WD181KFGX-68AFPN0_2JJH4USC (sdc and sdb respectively, yes, it’s a little weird that my sdb was the unused drive, and that would probably not be the case for most folks).
Then:
zpool attach big18Tzfs ata-WDC_WD181KFGX-68AFPN0_4BHDK1XH ata-WDC_WD181KFGX-68AFPN0_2JJH4USC
And, viola:
zpool status
Shows the new drive as resilvering:
NAME STATE READ WRITE CKSUM
big18Tzfs ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD181KFGX-68AFPN0_4BHDK1XH ONLINE 0 0 0
ata-WDC_WD181KFGX-68AFPN0_2JJH4USC ONLINE 0 0 0 (resilvering)