ZFS sending snapshots

OK Not sure if this was the place to put it but I am sure that @MichaelTunnell will tell me to move it if I need to.

I want to automate snapshots on a machine with ZFS and send those snapshots to another machine over SSH. I can make it happen but can’t seem to make it happen again when the second snapshot is taken.

I found a nice post that explains it pretty good but after the 2nd snapshot I don’t want to touch it again and his explanation requires you to know the different increments to send.

https://blog.programster.org/send-and-receive-zfs-snapshots

here is my simple script I was just going to cron but it isn’t working after the first snapshot is taken and sent.

    #!/bin/bash

    MYDATE=`date +%F-%T`

    # do the snapshot
    zfs snapshot  Storage/profiles@${MYDATE}

    #send snapshot
    zfs send  Storage/profiles@${MYDATE} | ssh my.server -p 2201 zfs receive tank/profiles@${MYDATE}

From what I have read that line requires the dataset to not exist so I need to do the incrementals … just looking for some guidance please. My google foo is not strong today and I keep barking up the wrong tree.

Day is over and time to go home but I might have just found my solution… anyone have any comments

I use sanoid. https://github.com/jimsalterjrs/sanoid

I use the following script between a Ryzen with Ubuntu 19.04 (64-bits) and a Pentium-4 with FreeBSD 12.0 (32-bits). I start it once per week manually, but I only send the changed records “-i” and compressed “-c”. I have to type my password twice, but I don’t have to store it.

/sbin/zfs snapshot vms/kvm@$2
/sbin/zfs snapshot vms/vms@$2
/sbin/zfs send -c -i vms/kvm@$1 vms/kvm@$2 | ssh bertadmin@192.168.1.100 zfs receive -F zroot/hp-data/kvm
/sbin/zfs send -c -i vms/vms@$1 vms/vms@$2 | ssh bertadmin@192.168.1.100 zfs receive -F zroot/hp-data/vms