i created 3 scripts for this problem
one to regenerate shares from zfs
#!/bin/bash -e
zfs get sharenfs -H -o name,value,source -t filesystem | grep -v off | grep -v "inherited from" | while IFS=$'\n' read LINE;
do
LINE=($LINE)
NAME=${LINE[0]}
SHARENFS=${LINE[1]}
echo regenerating share $NAME with $SHARENFS
zfs set sharenfs=off $NAME
zfs set sharenfs=$SHARENFS $NAME
done
second one to run on every shutdown of array to backup zfs nfs shares to $BACKUPLOCATION
#!/bin/bash -e
BACKUPLOCATION=/mnt/tank/storage/unraid/zfs-nfs/backup/
rsync --verbose --archive --human-readable --progress --partial --checksum --delete-after /etc/exports.d/ $BACKUPLOCATION
and last one to restore backup on every start of array
#!/bin/bash -e
BACKUPLOCATION=/mnt/tank/storage/unraid/zfs-nfs/backup/
rsync --verbose --archive --human-readable --progress --partial --checksum $BACKUPLOCATION /etc/exports.d
exportfs -ra