Backup FreeNAS ZFS Dataset to Ubuntu running ZFS

We are setting up replication of snapshots for backup purposes on FreeNAS. We setup Ubuntu server and install ZFS on it. We will use this system to receive snapshot for backup purposes.

We manually generated ssh key on FreeNAS. This was done by connecting to CLI and running commands below.

ssh-keygen -q -t rsa
scp id_rsa.pub username@remoteIP:/root

on ubuntu server side install ZFS and create pool

sudo apt-get install zfsutils-linux
sudo zpool status
sudo zpool create TESTPOOL /dev/sdb

Copy public key for replication to work

# if not already exists
$ mkdir /root/.ssh
# if not already exists
$ touch /root/.ssh/authorized_keys
# paste the contents of your FreeNAS root id_rsa.pub here
# if not already exists
$ chmod -R 600 /root/.ssh

Using FreeNAS GUI add Periodic snapshot task and Replication task to replicate to our Ubuntu ZFS pool
Using FreeNAS CLI
Node: Make sure root access is allowed via ssh in ssh configuration files. In other case replication will fail.

zfs list -t snapshot
zfs send -v mypool/dataset@snapshotname | ssh myhost zfs receive -v myotherpool/newdataset

On your Ubuntu system to see snapshots and find out how much space they take. Run the following commands

zfs list -t snapshot
zfs list -o space

You can now mount snapshot are back it up.
Some useful commands

zpool mount
zpool list
zpool status
zfs list -t snapshot -o name,creation -s creation
mount -t zfs P1/te/d1@auto-20181107.1203-2w  /mnt/test/   # mount snapshot named P1/te/d1@auto-20181107.1203-2w on /mnt/test