# GEOM Mirror vs ZFS Mirror



## gkbsd (Aug 12, 2014)

Hello,

I am interested to buy a new computer, I have a single HDD right now, but I'm studying the possibility to have a mirror in my next one. Apparently it is possible to do it with GEOM or with ZFS, and I would like to know the advantages and disavantages of both. In my eyes UFS2 with journaled soft-updates is super reliable and resilient, while ZFS is announced as "experimental" in FreeBSD 10 installation. On the other hand, ZFS allows for snapshots, and it's easy to set up a mirror, as it is included in the OS setup. So GEOM may seems more reliable and ZFS seems to have more features and easier to set up. As the new computer, if I make the jump, will have 8GB of memory, ZFS memory usage would not be an issue. However, I feel more familiar with UFS than with ZFS that I don't know at all. Also I was thinking about adding encryption, but that may complicate things a bit. I have to read again the GEOM part of "Absolute FreeBSD, 2nd Edition" that I do not have at hand where I am currently, unfortunately. I have just finished the draft of "FreeBSD Mastery: Storage Essentials" where Michael W.Lucas is writing that ZFS will be covered in "FreeBSD Mastery: ZFS" which I am eagerly awaiting   

What are you using or would use, and why ?

Guillaume


----------



## kpa (Aug 12, 2014)

ZFS itself is not experimental anymore in any sense in FreeBSD. What the "experimental" refers to is the support for ZFS on root installation in bsdinstall(8) where there are still many rough edges to hone out. ZFS on root itself is also pretty mature now.

I'm using a ZFS on root install on a single disk (using copies=2 for redundancy, the data on the system is not irreplaceable in any way), the installation was done manually from a FreeBSD 10-RELEASE USB memstick system.


----------



## formateur_fou (Aug 13, 2014)

Here is a link to setup a mirror with UFS and bsdinstall (I find the way to do it in the chapter 19.3 of the Handbook too complicated): http://www.ateamsystems.com/tech-blog/installing-freebsd-9-gmirror-gpt-partitions-raid-1/
I didn't give it a go as it is though. In fact, I tried to simplify this by creating the miror from a shell on the two whole disks and then got back to bsdinstall. From there, I partitioned the miror (which was correctly seen) and did a regular install. A the end I went back to the shell to fix /boot/loader.conf and /etc/fstab. But the reboot ended with an error 19 as seen in the Handbook.

As I was running out of time, I finally chose a ZFS mirror from the installation menu. It worked flawlessy and this is what I am still using now. The only thing is that it is not possible to choose the disk layout during installation. Here are the default for a 500G mirror:

```
% zfs list
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot                296G   153G   144K  none
zroot/ROOT          3,52G   153G   144K  none
zroot/ROOT/default  3,52G   153G  3,52G  /
zroot/tmp            844K   153G   844K  /tmp
zroot/usr            292G   153G   144K  /usr
zroot/usr/home       291G   153G   291G  /usr/home
zroot/usr/ports      849M   153G   849M  /usr/ports
zroot/usr/src        144K   153G   144K  /usr/src
zroot/var            789M   153G   788M  /var
zroot/var/crash      148K   153G   148K  /var/crash
zroot/var/log        452K   153G   452K  /var/log
zroot/var/mail       144K   153G   144K  /var/mail
zroot/var/tmp        152K   153G   152K  /var/tmp
```

ZFS is very flexible though, and it is easy to adjust these to your needs. Before that, I used, on the same computer, a GEOM mirror (the Handbook method was easier back then) and didn't notice much difference in term of memory usage or speed. It seems the computer boots a little quicker with ZFS.


----------



## wblock@ (Aug 13, 2014)

Please don't mirror GPT partitions.  I did that myself, wrote an article on it, had no problems, but gave it up anyway.  The main issue is when there is more than one partition, the replacements all resync at the same time.

Use MBR with gmirror(8), or use ZFS mirrors.

The Handbook procedure on creating a UFS mirror is more complex now.  On the positive side, it does not create a broken partition and metadata layout.


----------



## formateur_fou (Aug 13, 2014)

wblock@ said:
			
		

> Please don't mirror GPT partitions.


This point is stressed in the Handbook, and I remember using MBR through the installer (this choice is available when partitioning). I also made the mirror bootable as shown in the Handbook. I guess there is a way to use the bsdinstall on top of an empty mirror. Maybe, the disk layout schemes should be done, at least on one disk, before creating the mirror and using the installer...


----------



## phoenix (Aug 13, 2014)

Use the installer.  But, when you get to the disk partitioning stage, drop to a shell and do it manually.  It gives you instructions at the top of the shell for where to mount the root filesystem and to place the fstab file.

I've created multiple FreeBSD 10 installs on gmirror (using GPT, with 3 partitions for boot, ufs, and swap, only ufs being mirrored) using this method.  I've also created multiple FreeBSD 9 and 10 installs on ZFS using this method.

The manual setup is very powerful.  Anything you can create via a running FreeBSD system can be created in the installer via the manual partitioning method.


----------



## kpa (Aug 13, 2014)

People may not realize this but installation of FreeBSD is almost a brain dead simple process. After you have created the partitions and filesystems (UFS or ZFS, you choose) on the disks and installed the required bootloader it's essentially (assuming the newly created root file system is mounted /mnt):


```
tar -C /mnt -xvf /usr/freebsd-dist/base.txz
tar -C /mnt -xvf /usr/freebsd-dist/kernel.txz
```

That already gives you a fully bootable system that is just missing a few bits of set up that can be done after the first boot (unless you're using ZFS that requires adding the matching settings in /boot/loader.conf and /etc/rc.conf during install):


```
tzsetup
passwd
cd /etc/mail
make aliases
echo 'hostname="myhost.mydomain"' >/etc/rc.conf
```


----------



## gkbsd (Aug 13, 2014)

Thank you very much for all of your replies. I'm reassured about ZFS being reliable. I see that the installer creates many partitions, while on one hand it appears too much, on the other hand I guess it's easier to snapshot just the partition you need before applying an update for instance. I will try to look up for online ressources about ZFS to understand the beast, before playing with it   I find the handbook is covering ZFS rather quickly. In the meantime I'll do my tests in a Virtual Machine first, and will try the automatic and manual methods   

Guillaume.


----------

