Gpart: Adding mirror to existing zpool

Warren Block wblock at wonkity.com
Tue Sep 23 18:14:47 UTC 2014


On Tue, 23 Sep 2014, Beeblebrox wrote:

> Hi, Warren.
>
> Currently  my partition setup (excluding ada0). 4k alligned as you can see:
> =>       34  976773101  ada1  GPT  (466G)
>         34          6        - free -  (3.0K)
>         40    8388608     1  freebsd-swap  (4.0G)
>    8388648  159383552     3  freebsd-zfs  (76G)
>  167772200  809000928     2  freebsd-zfs  (386G)
>  976773128          7        - free -  (3.5K)
> =>        40  1953525088  ada2  GPT  (932G)
>          40    12582912     1  freebsd-swap  (6.0G)
>    12582952   209715200     3  freebsd-zfs  (100G)
>   222298152  1731226976        - free -  (826G)
>
> * ada1p3 and ada2p3 are the same pool as simple jbod (non-issue)
> * ada2p2 is what I want to mirror on ada2p2
> # gpart show -pr ada1 =>   167772200  809000928  ada1p2 (386G)
> 809000928 - 167772200 = 641228728
> # gpart add -a 4k -s 641228728 -i 2 ada2
> # gpart show ada2 =>   2  freebsd-zfs  ada2p2 (376G)  = 10G less than ada1p2

The first column is the starting block, the second column is the size, 
so it is not necessary to do the math.  Just create a partition the same 
size in the free space on ada2.  It does not need to start at the same 
location as the other partition on ada1, but it should be aligned to 4K 
for performance:

gpart add -t freebsd-zfs -a4k -s 159383552 -i2 ada2


More information about the freebsd-questions mailing list