# FreeBSD ZFS gmirror installation



## luckylinux (Oct 9, 2012)

As some of you may already know, I'm setting up a NAS at home using FreeBSD.
After such a long time, I got all the hardware I need.
I still have one question concerning the installation of FreeBSD itself ("root" disc).

I have read http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror, and plan to use 2x1TB HDDs for "root" partition.
I see 3 partitions are required/suggested in that tutorial: one for the bootloader (I think that's what's required on GNU/Linux when Grub2 + GPT are used), one for swap and one for the "/" device.


Maybe I didn't understand all of ZFS (yet), but I see you have to sub-partition the ZFS pool (?) by using the command

```
zfs create zroot/usr
```
to create the "/usr" partition.


Is it normal you don't have to specify a partition's size? Being used to GNU/Linux I usually specify the sizes of all of my partitions (even though with LVM I may be able to resize them easily).
Is therefore ZFS providing some kind of "dynamic space allocation"?


I read somewhere on the FreeBSD community forums that most of the times multiple partitions are suggested and in that case a size was specified for them. Or this is all UFS-related? For a ZFSOnRoot setup, are there additionnal partitions not listed in that guide?

I think I only need to setup one single slice and 3 partitions in fdisk/gpart. The rest should be taken care by "zfs" / "zpool", right?


Isn't there a way to fix the partition's (or whatever it would be called) size with the "zpool" command? Sometimes you just don't want some partitions to become too big ...
Or is using ZFS for Root just asking for problems?


----------



## kpa (Oct 9, 2012)

The ZFS filesystems are not partitions in any sense, they are allocated dynamically from the space available in the ZFS pool. For ZFS on root you will need one partition of type freebsd-boot on a bootable disk, it does not have to be on the same disk with the pool though. I'd also recommend putting swap on a separate freebsd-swap partition, swap on ZFS is possible but not recommended.


----------



## wblock@ (Oct 9, 2012)

gmirror(8) is not involved.  In the wiki article, it is used for swap, but not for the ZFS mirror.


----------



## luckylinux (Oct 9, 2012)

wblock@ said:
			
		

> gmirror(8) is not involved.  In the wiki article, it is used for swap, but not for the ZFS mirror.


So it's ZFS that takes care of the mirroring, right?

```
zpool create zroot mirror /dev/gpt/disk0 /dev/gpt/disk1
```


----------



## luckylinux (Oct 9, 2012)

kpa said:
			
		

> The ZFS filesystems are not partitions in any sense, they are allocated dynamically from the space available in the ZFS pool. For ZFS on root you will need one partition of type freebsd-boot on a bootable disk, it does not have to be on the same disk with the pool though. I'd also recommend putting swap on a separate freebsd-swap partition, swap on ZFS is possible but not recommended.



So it's just ok to not specify a size (or a maximum size) for each ZFS filesystem? Or it isn't even possible?


----------



## SirDice (Oct 9, 2012)

luckylinux said:
			
		

> So it's ZFS that takes care of the mirroring, right?
> 
> ```
> zpool create zroot mirror /dev/gpt/disk0 /dev/gpt/disk1
> ```


Yes.



			
				luckylinux said:
			
		

> So it's just ok to not specify a size (or a maximum size) for each ZFS filesystem? Or it isn't even possible?


You don't have to.


----------

