The general way to send ZFS data sets to remote nodes is normally achieved by sending the ZFS stream through ssh. The down side with this method is that ssh encryption is slow and has significant cpu overhead. You may find yourself in situations where you have very large datasets that you need to move from one ZFS host to another and you want it to be as fast as possible with as little cpu overhead as possible. The following method is good for local environments where you are not concerned about sending streams unencrypted. The tool that works very well for this is “netcat“.
This script does not create snapshots, it only sends them. At least 1 snapshot must be created for this script to run.
Create periodic snapshot task in the FreeNAS UI, or manually create a snapshot before running this script.
This script is designed to be used for initial data migration, not for periodic sending/receiving. This process sends an unencrypted stream of data over the network and should only be used in a secure environment
The most basic set up is the following:
curl -LO http://images.45drives.com/FreeNAS/scripts/zfs-send-recv-nc.sh
sh zfs-send-recv-nc.sh -s <volume/dataset> -n <remote_host>
This will find the most recent local snapshot of the specified volume/dataset and stream it to the specified remote host.
By default this script will assume the receiving volume/dataset has the same name as the sender. To use a different volume/dataset on the receiver use the “-v” flag.
A local volume: tank/dataset1
A remote host @ 192.168.1.3
A remote volume: tank/backups
sh zfs-send-recv-nc.sh -s tank/dataset1 -r tank/backups -n 192.168.1.3
SSH zfs send-recv = 30MB/s
Netcat zfs send-recv = 741MB/s