FreeNAS is a FreeBSD based Network Attached Storage Operating System, I like to think easy to use fast and flexible and very powerful.
Big thanks to the FreeNAS team for providing us with an exceptional piece of software and lots of cool features to play with ( and break ). Also thanks to the users on freenode#freenas for putting up with my constant questions and poking.
Setup Replication
The naming scheme I’m using is master-host [ The host to replicate from ] and slave-host [ The host to replicate to ]
Enable ssh + root password logins
This is a potential security risk ( we can disable the password logins after we are done. )
Go to the Services pane
Toggle SSH to on and edit the settings to reflect

FreeNAS SSH pane
In your terminal connect to the master-host and copy the replcation public cert from the active replication server to the backup replication server.
ssh root@[master-host-ip]
scp /data/ssh/replication.pub root@:/tmp/
Now on the master-host & slave-host create the ~/.ssh directories
mkdir ~/.ssh
On the slave-host copy the contents of the replication.pub cert we copied over to the authorized_keys file which will be located in your ~/.ssh/ directory and change the permissions on the authorized_keys file.
( this insures we get the key import in one line, and we restrict access )
mount -uw /
cat /tmp/replication.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Now on the master-host we are going to connect to the slave to check it’s working and also confirm each server to the known_hosts file. For this to persist reboots we need to mount the file system rw.
mount -uw /
ssh -i /data/ssh/replication

FreeNAS SSH Known Host confirmation
You will be asked to accept the host your are connecting to ( choose yes ).
Note: If you have a multi-homed setup you’ll need to repeat the above command for all addresses you want to do replication over.
GUI Configuration
To setup replication we will need to create a periodic snapshot task to replicate to the slave.
From the FreeNAS GUI enter the Storage pane and select “Periodic Snapshot Tasks” Shown below.

Create a new task with parameters relevant to your needs, below is an example of mine

Now to create the ZFS Replication, On the Storage pane select “ZFS Replication” shown below

Storage Replication Pane
Add Replication

Add new Replication
- Mount Point: The local dataset that has a replication task set you want to replicate
- Remote ZFS filesystem: The remote volume name you want to replicate to
- Remote hostname: IP or Hostname of the replication
- Remote hostkey: The public key of the remote host to replicate to ( see below )
How to get the remote host public key
ssh root@[remote-host]
more /data/ssh/replication.pub
copy this output to your favorite text editor
Note: It should be all one one line and NOT split
When your sure it’s not on multiple lines copy it to the Remote hostkey field on the Add Replication Window.
Now review your settings and hit Ok.