Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

How to increase the size of a ZFS Pool / Add drive to ZFS Pool

Today we’ll look at how to increase the size of a ZFS pool. We’ll do this by adding a new drive to the ZFS pool. ZFS makes this incredibly easy and you can do all this without destroying your data on the pool.

Rule of thumb: Always backup your data before attempting any kind modification to a filesystem/partition. No matter how much I or anyone else on the internet assures you otherwise, it’s always a good idea to be safe.

Start off by querying your system to list the drives attached. Issue the following at the terminal

lshw -class disk -class storage -short

The system should return a list of all the drives attached to your system, similar to below:

[root@localhost ~]# lshw -class disk -class storage -short
H/W path           Device      Class          Description
/0/100/1f.2        scsi0       storage        6 Series/C200 Series Chipset Famil
/0/100/1f.2/0      /dev/sda    disk           10TB TOSHIBA HDWR11A
/0/100/1f.2/1      /dev/sdb    disk           10TB TOSHIBA HDWR11A
/0/100/1f.2/2      /dev/sdc    disk           10TB TOSHIBA HDWR11A
/0/100/1f.2/2/0    /dev/sdc    disk           10TB
/0/100/1f.2/3      /dev/sdd    disk           120GB ZOTAC SATA SSD
/0/100/1f.2/3/0    /dev/sdd    disk           120GB
[root@localhost ~]#

You can make out this machine has three 10TB Toshiba drives and one 120GB Zotac SSD.

Next, list the drive composition of your ZFS pool or zpool, issue the following at the terminal:

zpool status

The system will return something like the following:

[root@localhost ~]# zpool status
  pool: mainpool
 state: ONLINE
  scan: none requested

        NAME        STATE     READ WRITE CKSUM
        mainpool    ONLINE       0     0     0
          sda       ONLINE       0     0     0
          sdb       ONLINE       0     0     0

errors: No known data errors
[root@localhost ~]#

From the output above we can tell that we have one zpool called mainpool and two out of three drives are part of it (sda and sdb). That leaves one 10TB drive available for the expansion (sdc). You can make this out from the information we pulled with lshw.

Now for the fun part, issue the following to add your unused drive to the pool. Let’s do a dry run first, add -n to the command

zpool add -n mainpool /dev/sdc
[root@localhost mainpool]# zpool add -n mainpool /dev/sdc
would update 'mainpool' to the following configuration:
[root@localhost mainpool]#

This looks fine, remove -n from the command and issue it again.

zpool add mainpool /dev/sdc

Look at the size of your pool to verify if it went through, issue this:

df -h

zpool partition size

That’s it, you’re done.