Trying to speed up your ZFS replication? Try ZFS send and receive with NetCat instead of SSH.
ZFS send and receive with NetCat
While restoring data from a backup FreeNAS server, I noticed my ZFS send and receives weren’t as fast as I needed. All the command line examples I found, just didn’t work.
Here are the commands that I successfully used on my FreeNAS servers:
ZFS Send with netcat
zfs send tank/test@manual-2020-08-27_19-18 | nc -w 20 10.0.1.2 8023
This means that the dataset “test” from my ZFS pool “tank” and snapshot “manual-2020-08-27_19-18” are being sent via netcat to host 10.0.1.2 on port 8023.
ZFS Receive with netcat
nc -l 8023 -w 120 | zfs receive tank/test
This means that netcat is listening on port 8023 for the dataset “test” and adding it to the ZFS pool “tank”.
Monitoring the progress of the ZFS Send and/or Receive
You can monitor the progress of the send stream by inserting the pv command between the zfs send and the zfs receive commands. In the following example, the first command estimates the stream size. Then with the second command, the snapshot is sent while being monitored at the same time.
Example:
nc -l 8023 -w 120 | pv | zfs receive tank/test
This is why you always need to keep spare hard drives around, and run in Raid-Z2 (double parity with variable stripe width) and gives you redundancy! If you don’t have any spare hard drives for your ZFS pool, then consider getting some now, before you end up losing data.
As an Amazon Associate I earn from qualifying purchases. Read our Privacy Policy for more info.