How to configure a RAID1 software mirror on FreeBSD

To setup GEOM Raid you first have to prepare the master disk with gmirror.
To do this you first have to label the disk with gmirror and load gmirror it self.

Since we want our Raid mirror to remain active after a reboot we have to add gmirror to the loader.conf in /boot.

After that you should replace the devices in /etc/fstab with the new geom mirror device.
I used sed to easy replace it, some people prefer to replace it by hand.

Now our mirror is prepared we can add more disks to the array so we will get our actual mirror.

In case you want to disable write cache to be sure everything gets written directly you should add the following to /boot/loader.conf:

This should give you a running RAID1 mirror with gmirror.
To view some more info about the disk input and output check out gstat.