Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2012 14:40:28 +0200
From:      Daniel Kalchev <daniel@digsys.bg>
To:        freebsd-stable@freebsd.org
Subject:   Re: grow zpool on a mirror setup
Message-ID:  <4F61E33C.1070506@digsys.bg>
In-Reply-To: <4F61D9F0.6000005@eng.auth.gr>
References:  <4F61D9F0.6000005@eng.auth.gr>

next in thread | previous in thread | raw e-mail | index | archive | help


On 15.03.12 14:00, George Mamalakis wrote:
> Hello everybody,
>
> I have asked the same question in the freebsd forums, but had no luck. 
> Apart of this, there might be a bug somewhere, so I re-ask the 
> question to this list. Here how it goes (three posts):
>
> post 1:
>
> "I am experimenting with one installation of FreeBSD-9-STABLE/amd64 on 
> a VirtualBox that is using gptzfsboot on a raid-1 (mirrored) zfs pool. 
> My problem is that I need to grow the filesystem size of zfs 
> partitions. I followed this guide 
> <http://support.freenas.org/ticket/342>(http://support.freenas.org/ticket/342), 
> which is for FreeNAS, and encountered a few problems.
>

You are using FreeBSD 9, while you follow instructions for FreeNAS. The 
ZFS version support in FreeNAS is way behind that in FreeBSD 9.

In particular, ZFS v28, which is in FreeBSD 9 supports the autoexpand 
property, that does not require export/import of the pool.

You mentioned you did use autoexpand, but perhaps didn't really 'expand' 
the zpool vdevs.

>
> "Since nobody has an answer that far, let me ask another thing. 
> Instead of deleting ada0p2 and ada1p2, and then recreating them from 
> the same starting block but with a grater size, could I have just 
> created two new filesystems (ada0p3 and ada1p3), and having them added 
> in the pool as a new mirror? Because if that's the case, then I could 
> try that out, since it seems to have the same result.
>

The proper way to expand an zpool is by replacing each underlying 
storage device with a larger one.
Replacing is the key word here. ZFS will not care if the same device 
suddenly became larger (if I am not mistaken).
So, to expand your zpool you have basically two options:

1. Detach one of the mirror members, make sure you clear ZFS metadata 
from the beginning and the end of the partition, recreate your 
partitions with larger sizes, then attach to the mirror. After 
resilvering and possibly verifying with scrub that you are not losing 
data, repeat with the other mirror member. If you have autoexpand=yes 
set, your zpool should grow.

2. If you can add more devices, then add a larger size device to the 
mirror. Or if you can, add two new larger devices to the mirror. After 
completing this, remove the old, smaller mirror members. As with the 
other option, your zpool should grow.

Do not add another mirror to the zpool, if you want to remove the old 
devices. Doing so will create second vdev in the zpool and will spread 
data over both (raid0 or stripe). Current versions of ZFS cannot remove 
vdevs from an zpool so in order to remove the smaller devices, you will 
have to backup, recreate the zpool and restore data.

Daniel




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F61E33C.1070506>