# Moving to larger mirrored disk, enlarge ZFS



## indul (Jun 19, 2010)

Hi!
I would like to install FreeBSD 8.1-RC1 on a 160GB HDD. 
My goals are:
* / partition 1GB, UFS
* /tmp /usr /var are ZFS, in the pool named bpool (base pool, 9GB)
* /data (ftp, www, mails, etc.) is ZFS, in dpool (data pool, rest of the disk ~130GB)
Thats easy, no problem.

What is the recommended solution to mirror the above scheme?
On UFS only system I used geom mirror (mirror the whole disk, it was perfect solution for me).
Question:
Later if I replace one member of the mirror to a 1TB disk. The mirror will rebuild, on the new disk I'll have the same 130GB dpool. After that I replace the original  160GB HDD to 1TB. Mirror rebuild, but dpool is only 130 GB.
How can I enlarge it to use the free space? / and bpool is 10GB, as previously.
Should I create 2 or 3 slices at install? (/, bpool, dpool; or /, ZFS)?
In case of error, the server must boot.

Thank you for the help.
In Dul


----------



## jem (Jun 24, 2010)

If your zpool(s) are using freebsd partitions as their underlying devices, then you will not be able to automatically expand the pools to fill larger disks, because the partitions don't automatically grow.  That's only possible if your zpools are built on top of raw disk devices (with no partitions).


As for your mirroring question, I would consider using an (almost) exclusive ZFS setup, on top of GPT partitions.

Your disks would have two GPT partitions, one tiny partition for the gptzfsboot image and, another partition spanning the rest of the disk.  Your zpool would be built on top of that large partition.

Partition your second disk identically, and add the second disk's large partition to your zpool mirror.

Then the only content on the disk not being automatically mirrored is the gptzfsboot code, but that's read-only and you can simply manually write it to both disks.

I have this setup on my colocated box and it works quite nicely:


```
beastie# gpart show
=>       34  312499933  ad4  GPT  (149G)
         34        128    1  freebsd-boot  (64K)
        162  312499805    2  freebsd-zfs  (149G)

=>       34  312499933  ad6  GPT  (149G)
         34        128    1  freebsd-boot  (64K)
        162  312499805    2  freebsd-zfs  (149G)

beastie# zpool status
  pool: rpool
 state: ONLINE
 scrub: none requested
config: 

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            ad4p2   ONLINE       0     0     0
            ad6p2   ONLINE       0     0     0

errors: No known data errors
```

EDIT:  Thinking about it further, I'm wondering if you can manually manipulate a partition table to make a partition larger and have ZFS notice that and automatically expand into the extra space.


----------

