Increasing the size of a ZFS pool

A few days ago I noticed my $home nagios was telling me one of my zfs pools was using all the space available. It is a 1TB pool, called multimedia consisting of two WD discs.

So I got myself two 3TB WD discs (right now there are two recicled WD green discs, which I know they are not ready for 24/7 usage, so I plan to get myself a WD RED in the future and replace one of those.

The process is quite easy:

1. Tell the pool one of the discs's gone missing. 
2. Plug in the new disc and use gpart to partition it. In my case I simply used a one large **freebsd-zfs** partition. 
3. Attach the new to pool, and tell the pool to use the remaining disc's data to fill in the new one.

Because the pool was set up with two discs in a mirror layout, when the first 3TB disc got plugged, the pool had two discs with differents capacities, so the total capacity of the pool couldn’t grow to 3TB (one of the discs still was 1TB).

Once the first 3TB disc is up to date, we would be able to replace the remaining 1TB disc that was still there. The process would the same we already described.

Let’s suppose the pool is called multimedia, and that the first disc was /dev/gpt/dades0 and the second was /dev/gpt/dades1. Let’s suppose the new disc is /dev/ada3.

To tell the pool one disc is gone missing:

    # zpool detach multimedia /dev/gpt/dades0

To partition the disc:

    # gpart destroy -F /dev/ada2
    # gpart create -s gpt ada2
    # gpart add -t freebsd-zfs -l dades0 ada2 

Finally, to attach that disc to the pool, using dades1 disc to synchronize the pool’s contents:

    # zpool attach multimedia /dev/gpt/dades1 /dev/gpt/dades0