can I consolidate a multi-disk zfs zpool to a single (larger) disk?
No, I don't think this is possible in the manner you're describing.
You can, however, create a new pool with the single disk and copy your ZFS filesystems to the new pool using a simple zfs send/receive process.
You should be able to zpool attach
the new and larger drive, wait for the mirroring to be completed, and then zpool detach
the old drives.
Edit: I had misread your question, and I was quite sure that you were running them as a mirror.
I agree that the best course of action is to create a new pool and recursively send all datasets to the new pool, but if you really cannot do that, then you could still follow the steps I'm outlining, provided that you partition the new, larger disk, into two partitions, each as least as large as the disk that it is meant to replace.
I recommend against this, mainly because (1) management becomes more complex, and (2) you won't be able to take advantage of the drive's write cache.
I'll paste here the sequence as performed on a recent Illumos box. Please note that I'm creating empty files to show this, instead of using whole disks and slices/partitions, as I can't juggle physical devices on that box. The files are named aa1
, aa2
and aa3
.
-
Prepare the devices.
aa3
is 200M large, whileaa1
andaa2
are 100M only:# dd if=/dev/zero of=/opt/local/aa1 bs=1M count=100 # dd if=/dev/zero of=/opt/local/aa2 bs=1M count=100 # dd if=/dev/zero of=/opt/local/aa3 bs=1M count=200
-
Create our test pool:
# zpool create test mirror /opt/local/aa1 /opt/local/aa2
Check that everything went smoothly:
# zpool list -v test NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT test 95,5M 106K 95,4M - 0% 1.00x ONLINE - mirror 95,5M 106K 95,4M - /opt/local/aa1 - - - - /opt/local/aa2 - - - -
-
Set the
autoexpand
property:# zpool set autoexpand=on test
-
Attach the new device:
# zpool attach test /opt/local/aa2 /opt/local/aa3
Is everything still fine?
# zpool list -v test NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT test 95,5M 120K 95,4M - 0% 1.00x ONLINE - mirror 95,5M 120K 95,4M - /opt/local/aa1 - - - - /opt/local/aa2 - - - - /opt/local/aa3 - - - -
Yes, it is.
-
Detach the first two devs:
# zpool detach test /opt/local/aa1 # zpool detach test /opt/local/aa2
Finally, let's check the pool again:
# zpool list -v test
NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT
test 196M 124K 195M - 0% 1.00x ONLINE -
/opt/local/aa3 196M 124K 195M -
It has correctly grown to 200MB.