One of the great features of ZFS is to be able to expand it using new, larger disks — even while it is online.

To do this you’ll replace each disk, one by one with a larger disk. After each replacement you’ll rebuild the zpool, and then move on to the next disk.

Once all the disks are replaced and have partitions (if you’re using partitions) expanded to the end of the larger disk you’ll run this command on each zdev member of the pool:

zpool online -e zroot /dev/da0p2

Where /dev/da0p2 is your zpool member device (we use partitions, so this example is partition #2).

Once you perform this on the last disk of the zpool ZFS will almost-instantly show the newly available size!

Call 1-828-376-0458 to Work With Professionals Who Truly Understand FreeBSD

A-Team Systems is a proud supporter of the FreeBSD Foundation and many of our administrators are direct project contributors.

 

2 Responses to “Expand ZFS To Use Larger Disks / Free Space”

  1. Marc Lobelle

    Hello Adam,
    This is what I was looking for. However I’m not sure to understand your sentence “To do this you’ll replace each disk, one by one with a larger disk. After each replacement you’ll rebuild the zpool, and then move on to the next disk.”.
    Do you mean: for each disk to replace,
    1. you stop the computer
    2. You replace physically one of the disks (for instance c1t1d0)
    3. you restart the computer
    4. As root, you type zpool replace rpool c1t1d0

    Reply
    • Adam Strohl

      Hey Marc,

      Correct — though if you have hot-swap drives you don’t need to stop the computer.

      Once you do the ‘zpool replace …’ command the pool will re-build with the new disk. You’ll want to wait until that’s finished and the pool is back to normal.

      Then you run the ‘zpool online …’ command to tell ZFS to use all of the space on the disk. You’ll see no change until the last disk.

      Once you do the ‘zpool online …’ for the last disk (ie; you’ve replaced them all) the pool will expand and show the additional free space for all disks.

      This is for FreeBSD and it looks like you’re working on Solaris or similar, but I would expect it works the same for any ZFS implementation including Solaris, Illumos, or Linux.

      Let me know if that helps!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.