FreeNAS makes replicating datasets or ZVOLs easy! In this example, we'll have one FreeNAS system (Storage-A) replicate its dataset called Infrastructure to another FreeNAS system (Storage-B). This example is fairly straightforward - tweak it to make it work for you! Here we go!
First, we'll browse to our source FreeNAS system and navigate to Tasks > Periodic Snapshot Tasks. Keep in mind that if you already have periodic snapshots configured, you can skip this step. These snapshots are mandatory in order to enable replication. Click the + button (top right).
When the add modal appears, choose the following:
ITEM | EXAMPLE VALUE | DESCRIPTION |
---|---|---|
POOL/DATASET | lun0/Infrastructure | The pool or dataset that you wish to replicate. |
RECURSIVE | Checked | This tells FreeNAS to snapshot all datasets under lun0/Infrastructure. For example, if lun0/Infrastructure contains a dataset called Tools, the snapshot will also contain Tools. |
SNAPSHOT LIFETIME | 2 weeks | If a file were to be deleted by accident, how long until it is noticed? In other words, how long do you wish to save the snapshot for. |
Fields such as begin, end, interval, and day of week are pretty self explanatory. If you have any questions, please click on the ? to the right of the form field. Check Enable and click Save once done.
Now that we have periodic snapshots configured for our Infrastructure dataset, we can setup replication. On the source FreeNAS box, navigate to Tasks > Replication Tasks and click on the + (top right).
Switch tabs and browse to the destination FreeNAS. Browse to Tasks > Replication Tasks and click on REPLICATION TOKEN. Copy the token to your clipboard.
Back on the source FreeNAS box, enter the following:
ITEM | EXAMPLE VALUE | DESCRIPTION |
---|---|---|
POOL/DATASET | lun0/Infrastructure | The pool or dataset that you wish to replicate. |
REMOTE ZFS POOL/DATASET | lun0/Backups | This is the destination pool or dataset where your replicated snapshot will be kept. On Storage-B (destination), we have a dataset called Backups where we'll dump anything we wish to backup. |
RECURSIVELY REPLICATE... | Checked | Again, if there is a pool or dataset underneath our Infrastructure dataset (such as Tools), checking this will take the children's snapshots as well. |
SETUP MODE | Semi-Automatic | For the purpose of this example (and for ease of use), we're selecting semi-automatic. |
REMOTE HOSTNAME | storage-b.test | The IP or hostname of the destination FreeNAS box. |
REMOTE AUTH TOKEN | token | This token is what you copied from the destination machine (see above). |
Lastly, click SCAN SSH KEY and it will auto populate. Once done, save the changes.
As you can see, our new replication job has been created! Keep an eye on the Status column.
If you browse back to the destination FreeNAS box, navigate to Storage > Pools. You should, after a few moments, see your replicated pool or dataset listed under the destination pool or dataset that you selected.
Once the replication task has completed, it'll set the Status column to Up to date.