How to Let ZFS Extend to Larger Disks

ZFS has a very convenient feature that lets you upgrade your storage capacity easily and in-service by replacing hard drives. You do need to know what you are doing though and you should have a back-up in any case.

We assume you have drive redundancy with three disks, each disk containing a complete mirror copy of all your data. (This procedure has not been tested.)

Larger Disk Upgrade Procedure

The steps are as follows. Replace <poolname> by the pool name you are working on.

[ ] Confirm that the mirrors are in-sync (resilvered)
$ spool status <poolname>
[ ] Check if autoexpand is enabled
$ zpool get autoexpand <poolname> 
[ ] If needed, turn autoexpand on
$ zpool set autoexpand=on <poolname>
[ ] Connect a new larger size drive physically
[ ] Dry-run the addition of new drive to the pool
$ zpool add -n <poolname> <existing-drive-id> <new-drive-id>
[ ] If ok, perform the actual addition
$ zpool add <poolname> <existing-drive> <new-drive>
[ ] Wait until the new drive is resilvered
$ zpool status <poolname>
[ ] Remove one old drive physically
[ ] Repeat the removal and addition process for all drive
[ ] Remove the old drives from the pool
$ zpool detach <poolname> <old-drive>

Once the pool only contains the larger drives, the pool size will increase to the new maximum. Caution: Pool sizes cannot be reduced other than creating a new pool!

With two redundant disks you could add a new disk at a temporary port, resilver, and then remove an old disk instead. If you have the port this is the better approach even with three disks.

This lets you increase the capacity while keeping the total number of ports and drives the same. If this is not a requirement, adding drives and using more ports can be used to increase the pool capacity also.

For other articles on ZFS see here.

Disclaimer: We are not responsible for any data loss as the result of reading our article We stress that you must confirm the accuracy of information in this article yourself and test your server thoroughly before placing any critical data on it.
updated: 20170704
photo: none

Leave a Reply

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